Info
此问题已关闭。 请重新打开它进行编辑或回答。
how to optimize a parameter using optimization tool?
1 次查看(过去 30 天)
显示 更早的评论
clear,clc
t=25; %temperature (C)
T=t+273; %temperature (K)
i_ph=3.113; %phase current [A]
e_g=1.12; %band gap [eV]
m_1=1.00; %diode factor
e=1.6*10^-(19); %electronvolt [j]
k=1.38*10^-(23); %Boltzmann constant [JK^(-1)]
U=(0:0.001:0.6); %voltage [V]
Ut=(k*T)/e;
ut=0.0257;
% underlying equation
Is = @(c_01) c_01 * T^3 * exp((-e_g*e)/(k*T));
I = @(c_01,U) i_ph - (c_01 * T^3 * exp((-e_g*e)/(k*T))).*((c_01) .* (exp(U./(m_1*Ut))-1));
fh = figure;
ah = axes(fh);
hold(ah,'on');
%plot(ah,U,I(170.8,U),'green', 'Linewidth', 1.5, 'DisplayName','real curve');
%plot(ah,U,I(470.80,U),'red','linewidth', 3, 'DisplayName','guessed curve');
legend show
% start value(s) for optimization
c_01_guess = 470.8;
% choose algorithm, and possibly other options for optimization solver
opt = optimoptions('lsqcurvefit');
opt.Algorithm = 'levenberg-marquardt';
% run optimization
c_01_opt = lsqcurvefit(I,c_01_guess,U,I(170.8,U),[],[],opt);
plot(ah,U,I(c_01_opt,U),'cyan','linewidth', 1.5,'DisplayName','optimization result curve');
axis(ah,[0,0.6,0,3.5]);
xlabel('Voltage');
ylabel('Current');
grid on;
1 个评论
回答(0 个)
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!