Items tagged with fit fit Tagged Items Feed

Dear All,

 

I am a new Maple user and I am still unaware of a lots of fancy features of Maple. I have a problem of simultaneous fitting polynomials. I wish that I could have help from you. Say, we have two polynomials of two variables,

f1(x,y)=a1+a2*x+a3*y+(a4+a5)*x2+(a4-a5)*y2;

f2(x,y)=b1+b2*x+b3*y+(a4-a5)*x2+(a4+a5)*y2.

Note that a4 and a5 are shared by the two polynomials. I would like to fit the two polynomials against their respective data set. Is there anyway I can do it using Maple? Any of your help is highly appreciated!

 

Best regards,

 

Toby

Hi 

friend i want fit a curve regarding some data and fnction and how we can find the values of a,b,c and d for the following 

f=1-(8*a*b+6*c*d/(b*k*x))/(2*a*b+c*b*(1/(b*k*x)))

X := Vector([200, 210, 220, 230, 240, 250, 260, 270, 280, 290])

Y := Vector([.4172, .3030, .4668, .3317, .1276, .1303, .1733, .1451, .3466, .4125])

Hey guys,

 

I want to fit experimental data and I was wondering if there is a special PolynomialFit function for a surface.

My data consist of a X,Y, Matrix of densities and I want to have a function describing the surface of the values. On matlab the following code will do so:

[x, y, z] = prepareSurfaceData(temps, concs, densities);
ft = fittype('poly33');
fitresult = fit([x, y], z, ft);

Maybe that gives you a better view of what I want.

Best regards

Howdy all,

I am trying to fit an exponential and logistical model to a set of population data i've been given using the NonlinearFit function in the statistics toolbox. When try to find the fit for the exponential function I get an error saying "SVD of estimated Jacobian could not be computed". Furthermore, when I display the regression over the set of data points all it shows is a horizontal line. I'm not sure how to go about fixing this. My data set is only 17 points and my input function is about as simple as it gets.

When I run the program to solve for logisitcal model I do not get the error but the displayed plot still shows just a horizontal line dispite the function being non-linear.

So far I have...

regE := NonlinearFit(a*exp(b*x),year,population,x)

regLog := NonlinearFit(a/(1+b*exp(-c*x)),year,population,x)

expon := plot((regE), x = 1850..2020):

logi := plot((regLog), x = 1850..2020):

display({data,logi,expon});

I have not tried using optimization yet but I will soon although I'm not sure if it will improve my results since my undertanding is that they both use the same process to estimate the parameters.

Anyways, Thanks for the help in advance!!

 

EDIT: Here is the data I am using.

year := [1850,1860,1870,1880,1890,1900,1910,1920,1930,1940,1950,1960,1970,1980,1990,2000,2010]:

population :=[4668,9070,17375,27985,37249,63786,115693,186667,359328,528961,806701,1243158,1741912,2049527,2818199,3400578,4092459]:

 

 

I have use a ''for cycle'' in order to get a series of points. I would like to save those points in a vector in order to use it for the ''PolynomialFit'' comand. The problem is that the points that I save are sort randomly. How can I take the value of the vector A in the right sequence? in the underline string you can plot the walue of A over t (which is not sorted). I can not use the sort command as I used for t even for A because the points are not increasing.

This is my code:

restart;

Atot := 0:

for ii from 0 by 0.01 to 2 do

PtotFkt := ii->  ii^2 :

Ptot := PtotFkt(ii):

Atot := Atot+0.01*Ptot:

A[ii] := Atot: #Save points in a Table

t[ii] := ii: #Save point in a table

end do;

AV := convert(A, list): #conversion from table to list
nops(AV);  #number of points

timme := convert(t, list): #conversion from table to list
nops(timme); #number of points

 

with(Statistics); #PolynomialFit

X := Vector(AV, datatype = float);

Y := Vector(sort(timme), datatype = float);

plot(Y, X, style = point, symbol = asterisk, color = blue);

regress := PolynomialFit(10, X, Y, time);

curve1 := plot(regress, time = 0 .. 2);

Given some points, how do I find the polynomial/exponential function best matches them?

points are:[[1030, 0], [380, 34], [270, 73], [240, 150], [85, 700], [22, 2000], [12, 5000]]

And here is a image too.

Points

I tried to fit a sin function to some data using Statistics[Fit] however the result either didn't work properly or worked differently from the way I expected it to work.

a2 is the calculated function from Statistics[Fit] and a3 is some quickly inserted values that provides a more satisfying result. 

Why is a better fitting line not found?


restart; gc()

X := [73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91]:

Y := [35, 35, 36, 41, 47, 42, 43, 37, 34, 28, 28, 30, 27, 33, 35, 38, 42, 42, 40]:

``

with(plots):

with(Statistics):

a1 := pointplot(zip(`[]`, X, Y)):

f := Statistics:-Fit(a*sin(b*x+c)+d, X, Y, x)

HFloat(2.1212360930685046)*sin(HFloat(1.0274743698606499)*x-HFloat(2.6022740116723866))+HFloat(36.46562486953954)

(1)

a2 := plot(f, x = 72 .. 92):

``

display(a1, a2)

 

f1 := 8*sin(.5*x-5.5)+36

8*sin(.5*x-5.5)+36

(2)

a3 := plot(f1, x = 72 .. 92):

``

plots:-display(a1, a3)

 

``


Download Fitting-Sine-off.mw

Fitted equation...

December 15 2015 hamid1 15

Hi

My function is shown below:

restart;

f:=(x,y)->evalf[5](2*x*Int(sqrt(1+y^2*(t*x-1)^2/(1-(t*x-1)^2)), t = 0 .. 1)):

printf(" x     y     f(x,y)\n");    

for x from 0.1 to 1.9 by 0.1 do

for y from 0.1 to 0.9 by 0.1 do

printf("%g   %g   %g\n",x,y,f(x,y));

od; od;

 


I want a relationship as follows to be fitted values of x,y, f(x,y)

f(x,y)=a1*x*sqrt(1+y^2*((a2*x-a3)^2/(1-(a4*x-1)^2)))

a1,a2,a3,a4=Coefficients that must be determined

 

Dear Maple users

I know how to fit a function with some parameters to some data, but how can it be done if the data is 2-dimensional? I mean: I have some time array T, some X array and some Y array. How do I fit a function with certain parameters to the data: (x(t),y(t)) to fit (X(T), y(T)), ...

Erik

I have used data and the curve fitting procedure to find a curve and I now have to put error bars on the graph to complete my task? I know that there is an errorplot function but I cant seem to find a way to do it with the curvefitting thing?

 

I have attached the whole worksheet, I hope someone can help! Thanks Detectors_Tutorial.mwDetectors_Tutorial.mw

 

Even if there was some method of exporting the graph to another medium that would also be very helpful

 

Hello, 

 

I am pretty new to Maple and Im trying to find the parameters of an equation using some kind of fit routine but I can only find such a routine to fit an expression to data and not vice versa.

my equation is as follows

 

epsilon(E):= a0 + a1*ln(E) + a2*ln(E)^2 + a3*ln(E)^3

 

I do have data for E which I imagine I need. 

 

E:= {121, 244, 344, 411, 444, 778, 867, 964, 1085, 1112, 1212, 1299, 1408} all in keV :)

 

Any suggestions/help would be much appreciated, although I am new to the program so go easy on me :) 

 

 

Cheers

I have some excel data which I need to fit in the formula:

0.5a*erfc(0.5*2^0.5*(-x+m1/s1)) + (0.5-0.5a)*erfc(0.5*2^0.5*(-x+m2/s2))

In this formula the coefficient m ans s are mean and standard deviation and a is the weigth of 2 peak in a cummulative gaussian distribution.

I fitted this (I will insert the maple file) and found:

-48736.43 erfc(-0.707x + 0.707) + 48736.43 erfc(0.707x + 0.707)

Can this be correct?

And how do I find the values of m1, s1, m2, s2 and a?

data.xlsx

data_fit.mw

Hello

I am working on a project where I need to find the parameters of the formula:

1/2*a*erfc(1/2*2^(1/2)*(-x+m1)/s1)+(1/2-1/2*a)*erfc(1/2*2^(1/2)*(-x+m2)/s2)

which is the formula for the cumulative distribution for two gaussian peaks, one with average m1 and standard deviation s1, the other m2 and s2, with weights a and (1-a). I have data in excel that form the gaussian distribution but now I need to find the parameters of the formula that fits these data.

Is there a command in maple to find these parameters or how do I start? And do I need to upload the data from excel to maple or do I need to insert only some values?

Some one who could help me, because it is really hard and I find no information for this.

Hasselhof

loock i have 3 models and a Matrix
>m3:=importmatrix("loslobos.txt");
>model[1]:=a*x;
>model[2]:=a^2*x+b;
>model[3]:=C-x^2+a;

so i apply a command named DataFit and it gives me 
>g:=Datafit(matrix,model[1]);

and that throws
         g:=[3,[a:=5],33];
so
         >g[1];
3
         >g[2];
5
         >g[3];
33
the variable that i care about is g[1] so every 3 models have differents g[1] so i need to pick the smallest g[1] and then use his model.
Example:=
>g:=Datafit(matrix,model[1]);
g:=[3,[a:=5],33];
>gg:=Datafit(matrix,model[2]);
gg:=[10,[a:=5,b:=10],44];
>G:=Datafit(matrix,model[3]);
G:=[1.1,[C:=5,a:=2],88];

then 

>plots:-display(plot(m3, style = point, symbol = diamond, symbolsize = 9), plot(eval("MODEL THAT SHOULD BE PLOT", THE G[2] OF THE MODEL), x = 0 .. 27, color = black));

The right one here would be 

>plots:-display(plot(m3, style = point, symbol = diamond, symbolsize = 9), plot(eval(model[3], G[2]), x = 0 .. 27, color = black));

so how do i select the model[3] for my plot? i knnow how the eval works so the problem here is to pick the right model please Help i hope that i isn't that Hard thnx
   

1 2 3 4 5 Page 1 of 5