|
Hi,
Currently I'm student and required Matlab program to compute parameters of my project.
Following is the program code:
>>x0=[0.026 0];
>>[xx fval]=fminsearch(@A2_sumerr,x0,options,Start,End,G,YDATA);
>>function sum= A2_sumerr(x0,Start,End,G,YDATA)
>>sum=0; %Initialise the sum of error
>>for a=Start:1:End
>> f(a)=x0(1)*((log(YDATA(a)/(x0(2)))-2)(YDATA(Start)/YDATA(a))*(log(YDATA(Start)/(x0(2)))-2));
>> g(a)=G(a);
>> Error=g(a)-f(a);
>> sum=sum+Error^2;
>>end
>>end
Start, End, G and YDATA are the extra input parameters for function sum. The purpose of this program is to optimize x0 value, such that i can obtained sum as the lowest possible value(approximately to 0). However, I could not get what i needed.
I would like to enquire that, can the optimization of this program make sure that sum will obtain 0 with the adjustment of x0? Or is there a better method to make that that sum will eventually goes to 0 with the optimized x0?
Hope someone could help me with this.
Thanks in advance.
|