How can i fit the data to the custom equation without using Curve fitting Toolbox ?
24 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have a data for voltage(V) with respect to time(t). I want to fit the curve with equation without using the curve fiting tool box,
V(t)=A+B*(1-exp(-t/C))+D*(1-exp(-t/E)),
where the parameters to be estimated are A, B, C, D, E
So please help me with the problem....
please go through the attached document for V-t data...
1 Kommentar
Rik
am 6 Sep. 2019
Your question is not urgent. That being said, you can define a cost function and use fminsearch to find the values of the parameters. Note that fminsearch is sensitive to initial estimate errors.
Akzeptierte Antwort
Matt J
am 6 Sep. 2019
Bearbeitet: Matt J
am 6 Sep. 2019
FMINSPLEAS will work well for this problem. It uses fminsearch, but in a savvy way that reduces the problem to only 2 unknowns. It can be downloaded from here,
For you, its application would look like,
flist={1,@(x,t) 1-exp(-t/x(1)) , @(x,t) 1-exp(-t/sum(x)) };
[x,y]=fminspleas(flist,[C0,C0+E0],tdata,Vdata,[0,0]); %C0 and E0 are initial guesses of C and E
A=y(1);
B=y(2);
C=x(1);
D=y(3);
E=x(2)-C;
0 Kommentare
Weitere Antworten (2)
Walter Roberson
am 6 Sep. 2019
You can fit any equation by calculating
SSE = @(Current_Parameters) sum( (Predicted_Value(Input_Independent_Variable, Current_Parameters) - Actual_Values).^2 );
and minimizing SSE .
Here, Predicted_Value would be your model function that takes your input independent variable and the current guesses at model parameters, and predicts the outputs for those parameters at the values of the independent variable. The current parameters will be input as a vector, so like
@(t,ABCDE) ABCDE(1) + ABCDE(2) .* (1-exp(-t./ABCDE(3))) + ABCDE(4) .* (1-exp(-t./ABCDE(5)))
0 Kommentare
Rik
am 6 Sep. 2019
Sligthly exanpding on what Walter suggests:
fun=@(ABCDE,t) ABCDE(1) + ABCDE(2) .* (1-exp(-t./ABCDE(3))) + ABCDE(4) .* (1-exp(-t./ABCDE(5)));
initial_guess=[1 1 1 1 1];%enter appropriate initial estimate
ABCDE=fit_fminsearch(f,x,y,initial_guess)
I attached my fit_fminsearch function. I don't feel it is quite ready for the FEX, but it will probably end up there is due time. This function doesn't require any toolbox and should work on all releases of both Matlab and GNU Octave. It uses fminsearch, so it is still sensitive to initial estimates being close to a local minimum or being too far off.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Interpolation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!