Professional Documents
Culture Documents
Curve Fit in Programming PDF
Curve Fit in Programming PDF
gp = ListPlot@fpD
70
60
50
40
30
20
10
5 10 15 20
H*this data is somehow parabolic .pehly hum iss pay linear fit lgye gain*L
? Fit
60
50
40
30
20
10
10 15 20
2 15-Curve Fit ,Interpolation.nb
Show@gp, ppD
70
60
50
40
30
20
10
5 10 15 20
H*as some points are missing in this fit so we will increase the terms*L
60
50
40
30
20
10
10 15 20
Show@gp, ppD
70
60
50
40
30
20
10
5 10 15 20
15-Curve Fit ,Interpolation.nb 3
? FindFit
FindFit@data, expr, pars, varsD finds numerical values of the parameters pars that make expr give a
best fit to data as a function of vars. The data can have the form 88x1, y1, …, f1<, 8x2, y2, …, f2<, …<,
where the number of coordinates x, y, … is equal to the number of variables in the list vars. The
data can also be of the form 8 f1, f2, …<, with a single coordinate assumed to take values 1, 2, ….
FindFit@data, 8expr, cons<, pars, varsD finds a best fit subject to the parameter constraints cons.
ff = a + b x + c x ^ 2 . para
- 1.92368 + 2.2055 x + 0.0746753 x2
60
50
40
30
20
10
10 15 20
4 15-Curve Fit ,Interpolation.nb
Show@gp, ppD
70
60
50
40
30
20
10
5 10 15 20
H*hum apni marzi say fit ya Findfit command use kr skty hain*L
H*exð49*L
ff = a + b x + c x ^ 2 . para
- 1.92368 + 2.2055 x + 0.0746753 x2
15-Curve Fit ,Interpolation.nb 5
60
50
40
30
20
10
10 15 20
Show@gp, ppD
70
60
50
40
30
20
10
5 10 15 20
6 15-Curve Fit ,Interpolation.nb
H*exð50*L
H*liner or parabola oper ho chuka hai agr cube krna chahty hain tou x^3 b
add krein or agr quarta krna chahty hain tou x^4 add krein jessy oper
example main hua hai and tigonometric k liye neechy krny lgy hain*L
fp
82, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71<
10 15 20
-5
gp
70
60
50
40
30
20
10
5 10 15 20
15-Curve Fit ,Interpolation.nb 7
60
40
20
5 10 15 20
60
40
20
10 15 20
60
40
20
5 10 15 20
8 15-Curve Fit ,Interpolation.nb
? Interpolation
Interpolation@8 f1, f2, …<D constructs an interpolation of the function values fi , assumed to correspond to x values 1, 2, … .
Interpolation@88x1, f1<, 8x2, f2<, …<D constructs an interpolation of the function values fi corresponding to x values xi .
Interpolation@888x1, y1, …<, f1<, 88x2, y2, …<, f2<, …<D constructs an interpolation of multidimensional data.
Interpolation@888x1, …<, f1, df1, …<, …<D constructs an interpolation that reproduces derivatives as well as function values.
Interpolation@data, xD find an interpolation of data at the point x.
Interpolation::inhr : Requested order is too high; order has been reduced to 80<.
H*Number of data points kamm hain iss liye error aaya so hum zayada data
points use krein gay bcz by default interpolation ka order cubic hota hai*L
sin = Interpolation@%D
InterpolatingFunction@880., 3.<<, <>D
sin@0.25D
0.247404
sin@0.2D
0.198692
Sin@0.2D
0.198669
15-Curve Fit ,Interpolation.nb 9
sin '@Pi 6D
0.865372
D@sin@xD, xD . x ® Pi 6 N
0.865372
D@Sin@xD, xD . x ® Pi 6 N
0.866025
H*Exð52*L
H*data given nhi hai so kuch b lay skty hain*L
d = 881.5, 2.1<, 82.3, 6.5<, 81.9, 4.3<, 81, 6.3<<;
i = Interpolation@dD
InterpolatingFunction@881., 2.3<<, <>D
10 15-Curve Fit ,Interpolation.nb
u =.;
b = D@i@uD, uD;
u = 1.9;
Print@"The function =", i, "\nThe area under the curve=", a, "\nThe slope =", bD
The function =InterpolatingFunction @881., 2.3<<, <>D
The area under the curve =5.05736
The slope =7.40085