Re: problems using FMINCON. Please help!



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.
.



Relevant Pages

  • Re: Large Number support in Matlab
    ... obtained by making many combinatorics calculations including factorials, ... The code was fully written using Matlab, ... Matlab to Maple because supposedly Matlab couldn't perform high accuracy ...
    (comp.soft-sys.matlab)
  • Re: Matlab is not a real array oriented language.
    ... libraries for linear algebra, which is all about 1D and 2D matrices. ... spent a lot of time and effort popularizing the name MATLAB. ... and allow the debugger to stop when certain errors or warnings are ... If the input is a vector, SUM ...
    (comp.soft-sys.matlab)
  • Large Number support in Matlab
    ... obtained by making many combinatorics calculations including factorials, ... The code was fully written using Matlab, ... Matlab to Maple because supposedly Matlab couldn't perform high accuracy ... any other math package. ...
    (comp.soft-sys.matlab)
  • Re: Excel beta - another bug
    ... As best as I can determine, the only difference in these calculations in 2007 ... For A1:A1048576, the data is in a single column, so all three formulas sum ... of Excel give zero for DEVSQ and STDEV when applied to with x equal ... has ever retained intermediate partial sums in 10-byte registers for SUM, ...
    (microsoft.public.excel)
  • Re: Large Number support in Matlab
    ... obtained by making many combinatorics calculations including factorials, ... The code was fully written using Matlab, ... Matlab to Maple because supposedly Matlab couldn't perform high accuracy ...
    (comp.soft-sys.matlab)