Re: Nonlinear regression 'nlinfit'



"Dan " <dbansal@xxxxxxxxxx> wrote in message
<fvrcbv$des$1@xxxxxxxxxxxxxxxxxx>...
I am having trouble using "nlinfit" function for a
fitting a
specific type of model to the data set. I would like to
fit
a model of the form of:
y = alfa*x1 + beta*exp(-gamma*x2)
where x1 and x2 are the predictor variables and y is the
response, while alfa, beta and gamma are the coefficients
to
be determined.

The help documentation on nlinfit seems to suggest that
the
function can be used to fit a custom model but I am not
able
to understand the syntax of the function calling (for the
model).

Has anyone come across a similar problem or has anyone
implemented nlinfit for their custom models? If yes,
please
send in your suggestions.
Here are the steps you need
Thanks,
db

1- write an M-file to define your function This should look
like
function f=model(a,x1,x2)
f=a(1)*x1+a(2)*exp(-a(3)*x2;

x1 and x2 should either be arrays with equal size or one of
then is a scalar. if they are of different sizes, you
should do a step by step calculation. for example, take all
x1 but one element of x2 or vice versa.
2- save the M-file to work
3- on matlab work space set some starting values for alpha,
beta and gamma by typing

a=[1 1 1] % for example
4- start the fitting by typing

a=nlinfit(x1,y,'model',a)
to see how the fit is
plot(x1,y,'*')
hold
plot(x1,model(a,x1,x2)
if it is OK, change x2 and start again
Aasim Azooz

.



Relevant Pages

  • Re: Nonlinear regression nlinfit
    ... response, while alfa, beta and gamma are the ... implemented nlinfit for their custom models? ...
    (comp.soft-sys.matlab)
  • Re: The Dangerous Liberty of Engineering vs. Lukewarm Dominionism
    ... with alpha, beta, and gamma also part of a smooth mani- ... violates CPT invariance, ...
    (sci.space.policy)
  • Re: New electromagnetic radiation from radioisotopes and XRF sources
    ... > type of radiation even in the case of beta decay. ... > those of gamma and X-ray sources, it needs a separate explanation than ... The atomic physics of nuclear gamma decay and nuclear beta ...
    (sci.physics)
  • Re: Update Query; But keep rest of field...
    ... Left$ and Right$ act like a scissors, counting from left or right, and cutting the string at that point, returning just that portion of the string. ... Comparing "Fitting ABS" with Left$will tell you if the beginning matches the eleven characters in "Fitting ABS". ... Will take "Fit ABS", and add everything except the first eleven characters, of tblItem.to it. ... Using the Design View to create a query, ...
    (microsoft.public.access.queries)
  • Re: Downcasting third layer class
    ... If the object is a Gamma, it is also a Beta so the first ... instanceof yields true and the second is never attempted. ... you have told Java "You already know that the object is an ...
    (comp.lang.java.programmer)

Loading