least square fitting of multiple variable equation (error: too many input arguments)
Ältere Kommentare anzeigen
I have a data file constituting 2 lines (EXP_x, EXP_y) and want to fit it with the equation mentioned in the second paragraph which has two variables (w, a).
here is the code
EXP=textread('filename')
global EXP_x
global EXP_y
EXP_x=EXP(:,1);
EXP_y=EXP(:,2);
w0=[0 0.5];
lb=[0 0.5];
ub=[20 2];
x=lsqcurvefit(@distribution,w0,EXP_x,EXP_y,lb,ub);
function calculation=distribution(w,a)
global EXP_x
global EXP_y
gamma=@(t) integral(t.^(w-1).*exp(-t),0,inf);
calculation=(a/((w^(3/2))*gamma)*exp(-(EXP_x/w).^a))
end
it doesn't work. Error: "lsqcurvefit too many input arguments in that case"
If it is not the proper case to use the lsqcurvefit, please tell me the replacement method.
Thank you.
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Problem-Based Optimization Setup finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!