Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

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


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: nolinear regression model
Replies: 20   Last Post: Jul 8, 2008 5:59 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Miroslav Balda

Posts: 67
Registered: 7/26/07
Re: nolinear regression model
Posted: Jul 8, 2008 2:56 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Miroslav Balda" <balda.nospam@cdm.it.cas.cz> wrote in
message <g4uuhm$t79$1@fred.mathworks.com>...
:
SNIP
:
> Hi Ender
>
> Could you send me some of your data? I'll try to solve it.
>
> Mira


Hi

I decided to show you a solution on a simulated example.
Here is the code:

% Ender 2008-07-08
a = 10, b = -8, c = -.2 % Model parameters
t = (0:.1:1)'; % should be a column vector
f = a + b*(1-exp(t/c)) + .2*randn(size(t));
% Column vector of residuals
res = @(x) x(1) + x(2)*(1-exp(t/x(3))) - f;
% solve it with rather bad estimate of parameters
x0 = [5,3,-.1];
[x,ssq,cnt] = LMFnlsq(res,x0)
plot(t,f, t,res(x)+f,'r'), grid

The output from the run has been:
>> Ender
a =
10
b =
-8
c =
-0.2000
x =
10.0640
-7.9915
-0.1926
ssq =
0.2140
cnt =
8
You see that after 8 evaluations of function and Jacobin
matrix, the solution of the example is close to the initial
a, b, and c. Differences are caused by random deviations in
the formula for f.
Hope it helps.
Mira





Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2010. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Goodwin College of Professional Studies.