lsqcurvefit - Parameter Optimization (Levenberg-Marquardt algorithm)

11 vues (au cours des 30 derniers jours)
Kavindu Mahadurage
Kavindu Mahadurage le 6 Fév 2021
I am currently doing an lsqcurvefit - Parameter Optimization project using the Levenberg-Marquardt algorithm for parameter optimisation for values asd1,asd2,asd3,etc, which are found in the following equation obtained using the spice model of a component.
This is an expression for a capacitance, however it’s expressed as Q (charge) in terms of V(source, drain) (source- drain Voltage).
Q=CV
Hence I considered V(source-drain) as X and integrated the whole expression in order to obtain an expression for C (capacitance) in terms of X which is V(source, drain). I did this simply because my ydata values are measured Capacitance values for varying V(source, drain) voltage values (xdata). I did this integration using Matlab so I doubt there are any errors there, however, I would like to know whether integration is the right thing to do if we want an expression for C from a Q expression.
This is the code that I used (Corrected by @Star Strider) :
xdata2=[0 2.5 5 7.5 10 12.5 15 17.5 20 22.5 25 27.5 30 32.5 35 37.5 40 42.5 45 47.5 50 52.5 55 57.5 60 62.5 65 67.5 70 72.5 75 77.5 80];
ydata2=[2458.8e-12 2448e-12 2418.8e-12 2400.1e-12 2355.5e-12 2261.1e-12 2102.4e-12 1874.4e-12 1551.5e-12 1356.8e-12 1246.8e-12 1196e-12 1160.6e-12 1137.2e-12 1125.7e-12 1105.8e-12 1093.7e-12 1073.9e-12 1058e-12 1046.3e-12 1038.6e-12 1022.6e-12 1006.5e-12 994.7e-12 978.8e-12 970.9e-12 950.9e-12 947e-12 931e-12 923.2e-12 915.3e-12 899.2e-12 895.5e-12];
asd1=6.7066e-10; asd2=1.3833e-09; asd3=-0.38247; asd4=47.537; asd5=1.1034e-09; asd6=-17.887; asd7=2.4197;
pinit2=[0.25;0.25;0.25;0.25;0.25;0.25;0.25];
psol = lsqcurvefit(@(param2,x)f2eq(param2,x,xdata2),pinit2,xdata2,ydata2);
disp(psol)
subplot(1,2,1)
p2 = plot(xdata2,ydata2,'ko');
p2.LineWidth=3;
subplot(1,2,2)
p2 = plot(xdata2,f2(xdata2,psol(1),psol(2),psol(3),psol(4),psol(5),psol(6),psol(7)),'b-');
p2.LineWidth=3;
function err2=f2eq(param2,x,y)
asd1=param2(1);
asd2=param2(2);
asd3=param2(3);
asd4=param2(4);
asd5=param2(5);
asd6=param2(6);
asd7=param2(7);
err2=x-f2(y,asd1,asd2,asd3,asd4,asd5,asd6,asd7);
end
function y2=f2(x2, asd1, asd2, asd3, asd4, asd5, asd6, asd7)
y2 = -asd2*asd4*polylog(2, -(exp(-asd3)*exp(x2))/asd4) - asd5*asd7*polylog(2, -(exp(-asd6)*exp(x2))/asd7)+asd1;
end
Hence, in the end, I must obtain values that are very similar to the asd1,asd2,asd3…. values given initially as the results contain negligible errors.
asd1=6.7066e-10; asd2=1.3833e-09; asd3=-0.38247; asd4=47.537; asd5=1.1034e-09; asd6=-17.887; asd7=2.4197;
However, the results I obtain are :
asd1=-47.5158
asd2=0.0004
asd3=0.1029
asd4= 0.5431
asd5= 17.8671
asd6=-116.5874
asd7= 0.0004
Could someone kindly help me identify what I have done wrong, because I must get equal or very similar values for asd1, asd2, asd3… just as given in the code as outputs.

Réponses (0)

Catégories

En savoir plus sur Optimization Toolbox dans Help Center et File Exchange

Produits

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by