From: Abhimanyu on
A function F has 2 parameters which I have to calculate. they are x and y in the function defined. f is the value of the function I have. This is the function file i have created:


function F=myfun1(X,t,f)
t=[1220 1771 1980 2100 2400 3000 3800 4100 4400 5000];
n=length(t);
x=X(1);
y=X(2);
for i = 1:n
f(i)=i/n;
end

F=(1-exp(power((-t/x),y)))-f;



and I m trying to find out the parameters by lsqr. But m not able to. What is it I should correct. Also if someone can tell me how to use "fit" for this purpose.

t=[1220 1771 1980 2100 2400 3000 3800 4100 4400 5000];
n=length(t);
for i = 1:n
f(i)=i/n;
end
f1=f;

x0=[1 1];
x=lsqr(@myfun1,x0,t,f1);