Effacer les filtres
Effacer les filtres

Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

how to optimize a parameter using optimization tool?

3 vues (au cours des 30 derniers jours)
Jannatul Ferdous Tania
Jannatul Ferdous Tania le 5 Mai 2020
Clôturé : MATLAB Answer Bot le 20 Août 2021
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 commentaire
Matt J
Matt J le 5 Mai 2020
Since you have complete code aready, what is your question?

Réponses (0)

Cette question est clôturée.

Produits


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by