# Items tagged with fitfit Tagged Items Feed

### Aproximation of given data...

February 09 2016
0 4

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.

### Fit data to sine function off...

December 17 2015
1 23

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.

 (1)

 (2)

### Fitted equation...

December 15 2015
0 1

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

### Fitting vector functions...

December 12 2015
1 6

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

### Putting error bars on curve fitting graph...

November 19 2015
0 3

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

### Fit routine to find parameters...

November 17 2015
0 5

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

### Fit of coefficients ...

August 11 2015
0 15

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?

### Fit based on Excel data...

July 13 2015
1 8

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

June 12 2015
1 2

### Picking the right model by min...

June 02 2015
1 2

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

### Is there any way to fit a curve with piecewise arc...

June 02 2015
0 6

Hi, I solved some equations those days and get a group of data, namely, Data1. Then I want to get the function of the data, so I use the CurveFitting package of maple, and get the function easily (the function seems as a*x^3+b*x^2+c*x+d). But the function is not the one I really wanted, because it is hard to generate the complex curve (even the function is known) in some software.

As I know, it is easily to generate some arcs in the software, so is there any way to fit a group of data with some piecewise of arcs?

Best regards.

Data1:= [[.690499054221957, .109364306247567], [.679584570047867, 0.955093827253927e-1], [.668476295825779, 0.820785684569687e-1], [.657171143364362, 0.690714704619819e-1], [.645665768347822, 0.564884351571898e-1], [.633956566493958, 0.443305616055764e-1], [.622039668654294, 0.325997176601303e-1], [.609910934797136, 0.212985591645471e-1], [.597565946804089, 0.104305524003572e-1], [.585, 0], [.572208093323944, -0.998792942142104e-2], [.559184918035503, -0.195271676259796e-1], [.545924844835652, -0.286107087732754e-1], [.532421909264435, -0.372305667237386e-1], [.518669795218710, -0.453777271949494e-1], [.504661816411590, -0.530420942817277e-1], [.490390895570740, -0.602124307834357e-1], [.475849541144774, -0.668762917052363e-1], [.461029821255068, -0.730199502124052e-1]]

### how to make Maple display a large 4 by 4 matrix wi...

March 02 2015
1 0

Maple 18.02 on windows. A 4 by 4 matrix, does not display on the screen in nice formating when it has too many elements to fit current screen. But I'd like it to be displayed in 2D just like all the other 4 by 4 matrices and then use the horizontal scroll bar if needed to see the full matrix. Is this possible?

------------------------------------

restart;
z:=theta__1:
T01:=Matrix([
[cos(z),   0,   sin(z),   L*cos(z)],
[-sin(z),  0,  -cos(z),   L*sin(z)],
[0,         1,  0,          0],
[0,         0,  0,          1]]):

z:=theta__2:
T12:=Matrix([
[cos(z),    0,   -sin(z),   L*cos(z)],
[sin(z),    0,    cos(z),   L*sin(z)],
[0,         1,  0,          0],
[0,         0,  0,          1]]):

z:=theta__3:
T23:=Matrix([
[cos(z),    0,   -sin(z),   L*cos(z)],
[sin(z),    0,    cos(z),   L*sin(z)],
[0,         -1,  0,          0],
[0,         0,  0,          1]]):

T02   := T01.T12;
T03   := T02.T23;
LinearAlgebra[Dimension](T03);
------------------------------------------------

T02 above displays in 2D fine. But T03 does not on standard 100% zoom on my monitor. Screen shot:

When I changed the zoom to 50%, now it did format ok on the screen:

May be I need a way to activate the horizontal screel bar? I really do not want to keep changing zoom each time I want to see a larger matrix. All the matrices are 4 by 4, but some of them can end up with many terms in each entry.

### Fit a Graph with 3 points...

February 19 2015
0 3

I'm wondering why the fit routine gives weird results, when telling him to fit

with(Statistics):

X:=Vector[column](3, {1 = 616.3096, 2 = 616.3248, 3 = 616.3342}, datatype = sfloat, storage = rectangular, order = Fortran_order, shape = []);

Y:=Vector[column](3, {1 = 99590., 2 = 127564., 3 = 144223.}, datatype = sfloat, storage = rectangular, order = Fortran_order, shape = []);

g:=Fit(a+b*x+c*x^2,X,Y,x)

It's telling me: Warning, model is not of full rank

If I calculate the coefficients the direct way (well the fit should be exact,because we only have 3 values and 3 parameters) I get:

M:=Matrix(3, 3, {(1, 1) = 1, (1, 2) = 616.3096, (1, 3) = 379837.52305216, (2, 1) = 1, (2, 2) = 616.3248, (2, 3) = 379856.25909504, (3, 1) = 1, (3, 2) = 616.3342, (3, 3) = 379867.84608964}, datatype = anything, storage = rectangular, order = Fortran_order, shape = []);
V:=Vector[column](3, {1 = 99590, 2 = 127564, 3 = 144223}, datatype = anything, storage = rectangular, order = Fortran_order, shape = []);
with(LinearAlgebra):
C:=MatrixVectorMultiply(M^-1,V)

### Is there a bug in stats fit?...

January 19 2015
0 32

I am fitting polynomial differential equations to data, and I came across some troubling behavior. I have sets of coordinates in x, y, z, and values w at these coordinates. The x,y,z coordinates and the data at these coordinates are concatenations of three subsets of data each, and depending on the order of the concatenation, I get different polynomials from the stats fit command. The difference is not trivial -- it makes a huge differentce in the stability of the differential equations. I have written a demonstration worksheet to show this problem.

John Starrett

### Exponential fit for AIDS data...

October 30 2014
1 1

Hi I am working on the following problem (See below the line) from the text A Introduction to the Mathematics of Biology (Ch 2 pgs.21-23). I am working in Maple 18 and the code for this problem is from Maple 11 I think. If you look at the last line of code, I ran into a snag. Can anyone help????? We are in a study Gourp and alll are stumped.

_______________________________________________________________________________________________________

Problem # 2 - Find a fit for the cumulative US AIDS data as a polynomial function. Alsoo find an exponential fit for the data. (assume the Data I have inputed is correct if you don't have the book).

AIDS := [97, 206, 406, 700, 1289, 1654, 2576, 3392, 4922, 6343, 8359, 9968, 12990, 14397, 16604, 17124, 19585, 19707, 21392, 20846, 23690, 24610, 26228, 22768];
print(`output redirected...`); # input placeholder
[97, 206, 406, 700, 1289, 1654, 2576, 3392, 4922, 6343, 8359,

9968, 12990, 14397, 16604, 17124, 19585, 19707, 21392, 20846,

23690, 24610, 26228, 22768]

CAC := [seq(sum(AIDS[j]/(1000.0), j = 1 .. i), i = 1 .. 24)];
print(`output redirected...`); # input placeholder
[0.09700000000, 0.3030000000, 0.7090000000, 1.409000000,

2.698000000, 4.352000000, 6.928000000, 10.32000000,

15.24200000, 21.58500000, 29.94400000, 39.91200000,

52.90200000, 67.29900000, 83.90300000, 101.0270000,

120.6120000, 140.3190000, 161.7110000, 182.5570000,

206.2470000, 230.8570000, 257.0850000, 279.8530000]

Time := [seq(1981+(i-1)*(1/2), i = 1 .. 24)];
ln(CAC)=k*lnt+A
LnCAC := map(ln, CAC);
print(`output redirected...`); # input placeholder
[-2.333044300, -1.194022473, -0.3438997525, 0.3428802329,

0.9925107578, 1.470635510, 1.935571171, 2.334083760,

2.724054775, 3.071998629, 3.399328971, 3.686677031,

3.968441145, 4.209145378, 4.429661370, 4.615387808,

4.792578782, 4.943918402, 5.085810791, 5.207062453,

5.329074480, 5.441798471, 5.549406770, 5.634264465]
LnTime := map(ln, [seq((i+1)/(2*(1/10)), i = 1 .. 24)]);
print(`output redirected...`); # input placeholder
[ln(10), ln(15), ln(20), 2 ln(5), ln(30), ln(35), ln(40), ln(45),

ln(50), ln(55), ln(60), ln(65), ln(70), ln(75), ln(80), ln(85),

ln(90), ln(95), 2 ln(10), ln(105), ln(110), ln(115), ln(120),

3 ln(5)]
with(stats);
fit[leastsquare[[x, y], y = k*x+lnA]]([LnTime, LnCAC]);
print(`output redirected...`); # input placeholder
y = 3.293411005 x - 10.12289000
k := op(1, op(1, rhs(%))); LnA := op(2, rhs(`%%`)); A := exp(LnA);
print(`output redirected...`); # input placeholder
Error, invalid input: rhs received exp(LnA), which is not valid for its 1st argument, expr
Error, invalid input: rhs received exp(LnA), which is not valid for its 1st argument, expr
exp(LnA)

 1 2 3 4 Page 1 of 4
﻿