Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: nlinfit in STATS toolbox
Replies: 1   Last Post: Dec 9, 1996 11:00 AM

 Messages: [ Previous | Next ]
 John Boccio Posts: 11 Registered: 12/7/04
nlinfit in STATS toolbox
Posted: Dec 9, 1996 9:19 AM

Hi,

Using the m-file below we are trying to fit data to a simple nonlinear
function. See bottom of m-file for function pretrans.m.

The fit is terrible. I have compared the nlinfit result to a result from
Kaleidagraph (see final plot from m-file).

Anyone know what is happening here? Are we using nlinfit wrong?

Thanks,

John Boccio
boccio@swarthmore.edu

% petfit.m
x = [118.9000
119.0000
119.1000
119.2000
119.3000
119.4000
119.6000
119.8000
120.0000
120.2000
120.6000
121.0000
121.4000
121.8000
122.6000
123.4000
124.2000
125.0000];

y = [238.4000
222.9000
208.6000
197.4000
186.3000
176.3000
160.8000
148.8000
136.9000
128.1000
113.3000
102.3000
93.2000
87.5000
76.6000
68.0000
61.3000
55.0000];

beta0=[388,117]';

best=[387.45,117.24]'

[beta,r,j]=nlinfit(x,y,'pretrans',beta0);

plot(x,y,'ro',x,pretrans(beta,x),'y',x,pretrans(best,x),'c')
legend('DATA','NLINFIT','OTHERFIT')

% function yhat=pretrans(beta,x)
% yhat=beta(1)./(x-beta(2));

Date Subject Author
12/9/96 John Boccio
12/9/96 Matt Silvia