Azzera filtri
Azzera filtri

Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

how to optimize a parameter using optimization tool?

3 visualizzazioni (ultimi 30 giorni)
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 Commento
Matt J
Matt J il 5 Mag 2020
Since you have complete code aready, what is your question?

Risposte (0)

Questa domanda è chiusa.

Prodotti


Release

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by