I tried changing the tolerance like this....
options = optimset('TolFun',1e-8);
[N,resnorm] = lsqnonlin(@myfunction5,n,[],[],options);
definition of myfunction5....
function r5 = myfunction5(N) global f1 f1 = 999000; r = zeros(10000,1); f = zeros(10000,1); for p = 1:10000 r(p,1) = 5 * sin(2*3.14*f1*(p/(10000000))+0.3); end for q1 = 1:10000 f(q1,1) = N(1) * sin((2*3.14*N(2)*(q1/10000000)) + N(3)); end r5 = r-f; end
But it is displaying this message and the value of N hence achieved is far from my requirement...
Local minimum possible.
lsqnonlin stopped because the final change in the sum of squares relative to its initial value is less than the selected value of the function tolerance.
How to set this up?