Re: problems using FMINCON. Please help!
- From: Torsten Hennig <Torsten.Hennig@xxxxxxxxxxxxxx>
- Date: Thu, 16 Apr 2009 02:52:52 EDT
I am trying to write down in code what you're
explaining but I am not able to. What do you mean by
the "backslash operator A\b": i am trying to read on
the guide about least squares and optimization but
still am not able to arrive to a solutions.
when you write a(j).... does it mean I have to put
that part inside a loop?
could you write the piece of code for the little
example
xdata= [-4.22; -3.64; -3.35; -2.79; -0.0076; 1.71];
ydata= [0.34; 0.28; 0.26; 0.25; 0.1424; 0.137];
jdata= [100; 200; 300; 350; 1000; 900];
and pass through point
z=ydata(5);
z2=xdata(5);
so that I can visualize it?
Afterwards I will be able to apply it into the actual
case I am working on.
Also, if I am not using the function fit anymore, how
can I get statistics such as R^2 and RMSE with this
method?
Sorry for all the bothering,
Thanks again
I'll give you FORTRAN code because I do not use MATLAB
for my calculations:
sum = 0.0
Do i = 1, 6
sum = sum + jdata(i)
end do
Do i = 1, 6
coeff(i) = sqrt(jdata(i)/sum)
end do
C Create Design matrix
Do i = 1, 6
A(i,1) = coeff(i)*(xdata(i)-xdata(5))
A(i,2) = coeff(i)*(xdata(i)**2-xdata(5)**2)
end do
C Create vector of the right hand side
Do i = 1, 6
b(i) = coeff(i)*(ydata(i)-ydata(5))
end do
C Solve linear system A*beta = b to get regression
C coefficients
C !MATLAB command
beta = A\b
I think statistical data have to be calculated by yourself afterwards.
Take a look at
http://www.mathworks.com/access/helpdesk/help/techdoc/index.html?/access/helpdesk/help/techdoc/math/f4-983672.html&http://www.google.de/search?hl=de&q=matlab+%26+overdetermined+linear+system&meta=
how to set up the problem in MATLAB.
Best wishes
Torsten.
.
- References:
- Re: problems using FMINCON. Please help!
- From: rib ribo
- Re: problems using FMINCON. Please help!
- Prev by Date: Re: Problem using Parfor and Neural Networks
- Next by Date: Re: index position for multidimensional array in matlab
- Previous by thread: Re: problems using FMINCON. Please help!
- Next by thread: Re: Distance between two distributions
- Index(es):
Relevant Pages
|