lsqnonlin returns: Length of lower bounds is > length(x)
Show older comments
Hi
I recently just started using Matlab and am trying to find my way around. I am trying to use it to solve for unknown parameters for my X and Y dataset. I tried using the curvefit toolbox but it always result in a negative R^2 value. I am trying to use lsqnonlin function to find the optimized values for the unknown.
My FES.m file
function FES = unknown(x,Y)
K=x(1);
A=x(2);
v=x(3);
FES = ((Y/(1-Y)*exp(2*A*Y))^v)/K;
To evaluate 3 unknowns I used the FES.m file as follows
X =
1.0e-007 *
0
0.0001
0.0003
0.0005
0.0007
0.0014
0.0035
0.0069
0.0692
0.3460
0.6920
Y =
0
0.2018
0.2018
0.2385
0.1713
0.1468
0.3180
0.3333
0.1774
0.6239
0.9297
x0 =
10000000 1 1
[x,resnorm] = lsqnonlin(@FES,x0,Y,X)
Which returns:
Warning: Length of lower bounds is > length(x); ignoring extra bounds.
> In checkbounds at 27
In lsqnsetup at 56
In lsqnonlin at 191
Warning: Length of upper bounds is > length(x); ignoring extra bounds.
> In checkbounds at 37
In lsqnsetup at 56
In lsqnonlin at 191
Exiting due to infeasibility: 2 lower bounds exceed the corresponding upper bounds.
I would appreciate if someone can point out what I am doing wrong, or if there is a better method to do this. Many thanks.
2 Comments
Oleg Komarov
on 24 May 2012
What is the vector X? Do you want separate coefficients for X and Y?
You're using the syntax of lsqnonlin() incorrectly but I cannot help before you clarify the two points I raise.
Sargondjani
on 25 May 2012
the syntax is: x = lsqnonlin(fun,x0,lb,ub)
so Y and X are lower and upper bounds... which contain more entries than x0 (scalar). this is why you get the error
Answers (0)
Categories
Find more on Optimization Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!