Items tagged with fit fit Tagged Items Feed

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)

From some scientific experiments, the following set of data is available
(1.0, 2.33),(2.0, 0.0626),(3.0, −2.16),(4.0, −2.45),(5.0, −0.357),(6.0, 2.21),(7.0, 2.75),(8.0, 0.636),(9.0, −2.45).

We need to use least squares method to fit the curve to the data
y = a + b cos(x) + c sin(x) + d cos(2x) + e sin(2x)


Show your solution procedure in Maple and get the best fit for the coefficients. Finally
plot the data and the y curve together on the same graph to visualize the fitting. For the
data, use blue circles while for the y curve, use red solid line style. Use the leastsquares
command we learned in LinearAlgebra package.

Hello everyone,

I'm trying to do some fitting using NonlinearFit, for the coefficients I know in advance, that they have to fulfill a condition (a+b>c+1). I couldn't find a way to make Maple take this condition into consideration while fitting my data. I tried to use Parameterrange to make the difference a+b-c+1 positive, this works for linear conditions like mine but leads to computational difficulties and errors like "no improved point could be found".

Thanks in advance,

Sören

i have a non linear equation that depends on three variables e, theta and z.

i have done calculations to calculate e while varying theta and z. theta varied among the vector [0, Pi/4, Pi/3, Pi/2] and z was varying between 1 and 20

when plotting my data it gives the following plot where z is represented on the x-axis and each curve correspond to one theta

 

i am currently able of fitting one plot to one equation i would like to fit the data points using the nonlinearfit function and to only get one equation for all the plots. is that possible in maple or not

 

Hi everyone,

I have a question about surface fitting. I tried to follow the step of application "Fitting an Ellipse to Data" to fit the ellipsoid surface but got the incorrect result:

 

 

It seems that the convergence condition can be modified but I have no idea. 

The related Maple file is attached:

Ellipsoid_Surface_Fitting.mw

I'd appreciate any help on this topic. Thank a lot.

Hello everyone!

I have a question that I can't seem to find a straight answer to. I need to fit a circle to a collection of points that a circular in nature. I was trying to use the following elliptical least squares fit, but I can't determine what I should be minimizing.

Here's the page:

http://www.maplesoft.com/applications/view.aspx?SID=1395&view=html

 

For an ellipse, I used the general conic:

F:=a*x^2+b*x*y+c*y^2+d*x+e*y+f

I minimize using:

V:=Minimize(E,{4*a*c-b^2=1});

 

What would I use for a circle? Or is there a better way for a circle?

Hi

 

I have some data:

Matrix(10, 2, {(1, 1) = 0, (1, 2) = 0, (2, 1) = .5, (2, 2) = 3.25, (3, 1) = 1.0, (3, 2) = 5.82, (4, 1) = 1.5, (4, 2) = 7.50, (5, 1) = 2.0, (5, 2) = 8.79, (6, 1) = 2.5, (6, 2) = 9.83, (7, 1) = 3.0, (7, 2) = 10.66, (8, 1) = 3.5, (8, 2) = 11.35, (9, 1) = 4.0, (9, 2) = 11.94, (10, 1) = 4.5, (10, 2) = 12.46})

 

I want Maple to make a trendline fitting a Logarithmic function. I can make it output some function with this:

LeastSquares(`<,>`(.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5), `<,>`(3.25, 5.82, 7.50, 8.79, 9.83, 10.66, 11.35, 11.94, 12.46), x, curve = a+b*ln(x))

It outputs:

5.96497783539274+4.25309474196387*ln(x)

 

But please notice, the dataset in the function does not have the first 0 and 0. If i do that:

LeastSquares(`<,>`(0, .5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5), `<,>`(0, 3.25, 5.82, 7.50, 8.79, 9.83, 10.66, 11.35, 11.94, 12.46), x, curve = a+b*ln(x))

It outputs: 

Error, (in Matrix) numeric exception: division by zero

 

Besides that, i need the R-squard value for determinating how well it fits.

 

If i do the same thing i Excel the data set will give a formular: 5.5464ln(x)-0.2175 with a R-sward value of 0.9985.

 

How can i do this i maple?

 

Thanks in Advance!

 

----

Emil Kristensen

Hi there!

I wrote a piece of code which spits out the numerical datapoints (x,y(x)) corresponding to a function y(x). So that the result is accurate, I need quite a lot of data points - currently I am working with 5k.

In order to work with this function later, I interpolated it with a Spline. For instance, I would like to sample the function values on a fifferent grid, etc.. However the evaluation of this function really takes up hell of a lot of time, and the reason seems to be, that it, being a spline on 5k nodes, is simply a huge expression.

Is there a better way to do this? Are other fitting functions than a spline maybe better suited?

Thanks for help!

 

Hi everyone,

I have a very complicated function y with only one independent variable x, and want to fit or approximate it by a simpler function, say polynomial. Many books or maple reference seem to tell how to fit a set of data instead of a given function. But the argument x in the function is assumed to be continuous other than discrete, so I don't know whether it is possible to express datax in form of x's range such as 0..1, and express datay in form of the function. After that , maybe I can fit the two created data sets by a polynomial function.

Or, does anyone have a better or more direct way to do the fitting linking two fucntions?

I am appreciated for your help.

Best,

GOODLUCK

Hello every one,

restart;with(stats):

with(stats[statplots]):
with(plots):

x1_values:=[0.1, 0.20, 0.30, 0.40, 0.50, 0.60, 0.70, 0.80];

x2_values:=[1, 2, 3, 4, 5, 6, 7, 8];

x3_values:=[11, 12, 13, 14, 15, 16, 17, 18];

x4_values:=[10, 20, 30, 40, 50, 60, 70, 80];

y_values:=[30, 40, 60, 70, 90, 120, 150, 200];

How to fit the above data into the following equation

y=a+b*x1+c*x2+d*x3+e*x4+f*x1^2+g*x2^2+h*x3^2+i*x4^2+j*x1*x2+k*x1*x3+l*x1*x4

+m*x2*x3+n*x2*x4+p*x3*x4;

Thanks

 

 

 

I have to make a plot for experimental data where x corresponds to time and y is the concentration. So I loaded the values in two lists, ran fit to least squares and got the best fitting curve (it's linear). However, the line has to start at (0,0). How can I Maple to do that for me?

Hey 

I'm trying to fit a spacecurve onto some points I have. 

I know, I can use Spline to do this in 2D, but it doesn't work in 3D.

What command(s) can I use to fit a spacecurve onto my points? 

Thanks in advance

How does one find a formula that  fits a given set of data  to the best advantage in Maple? 

 

e.g

a := [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];

b := [ 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.011, 0.011, 0.011, 0.011, 0.011, 0.011, 0.011, 0.011, 0.011, 0.011];

c := [ -0.88, -8.87, -0.86, -0.82, -0.77, -0.71, -0.66, -0.62, -0.57, -0.54, -0.89, -0.88, -0.85, -0.81,...

Hello,

 

I have two sets of data representing two function that depends on x with a parameter A.

I need to do a fit on both data series at the same time so to fit with the best parameter A.

 

Here is how I do a fit on one function

 

> f(x):=A*cos(x-B)^(2);               
> g(x):=A*(cos(x-C)^(2)+ sin(x-C)^(2))^2; 
> fit1 := Fit(f(x), r, x, parameternames = [A, B, C...

MAPLE Users,

Suppose I have a set of points in some N-dimensional space.  I would like to obtain a simple polynomial that

best fits the data.  I do not know in advance the form of the function, but a simple function that does not overfit

the data would probably be OK.  By "simple" I mean the smallest degree with or without cross-terms that gives a

decent fit.  My data set will typically be an external comma or tab separated text file.

1 2 3 4 Page 1 of 4