how can I get 5 parameters in using the optimization tool of an equation

1 回表示 (過去 30 日間)
Jannatul Ferdous Tania
Jannatul Ferdous Tania 2020 年 5 月 12 日
回答済み: Alan Weiss 2020 年 5 月 12 日
how can i optimize the 5 parameters of the following equation,
have to determine the c_1,c_2,m_1,m_2,r_s,r_p. the actual vaule is given;c_1=170.80; % [AK^(-3)],c_2=18.8e-3; % [AK^(-5/2)],m_1=1.00; % [ ], m_2=2.00; % [ ]
r_s=50e-4; % [Ohm], r_p=5;
given the parameters, t=25; %temperature (C),,i_ph=3.113; %phase current [A],e_g=1.12; %band gap [eV], e=1.6*10^-(19); %electronvolt [j]
k=1.38*10^-(23), %Boltzmann constant [JK^(-1)], U=(0:0.001:0.6); %voltage [V]

回答 (2 件)

Jannatul Ferdous Tania
Jannatul Ferdous Tania 2020 年 5 月 12 日
for optimaization one parameter i got,
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]
c_01=170.80; %co-efficient of saturation current [AK^(-3)]
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
I= i_ph - (c_01 * T^3 * exp(-((e_g*e)/(k*T)))) .* (exp(U./(m_1*Ut))-1);
plot(U,I,'linewidth',2.5,'DisplayName','real curve');
axis([0,0.6,0,3.5]);
xlabel('Spannung U');
ylabel('Strom A');
grid on;
% legend show
hold on
% c_01_guess=870.80; %co-efficient of saturation current [AK^(-3)]
%
% I= i_ph - (c_01_guess * T^3 * exp(-((e_g*e)/(k*T)))) .* (exp(U./(m_1*Ut))-1);
% plot(U,I,'linewidth',2.5,'DisplayName','guessed curve');
%first define optimization variables
c_01=optimvar('c_01');
m_1=optimvar('m_1');
%create expression for the objective function, which is the square to minimize
fun=i_ph - (c_01 * T^3 * exp(-((e_g*e)/(k*T)))) .* (exp(U./(m_1*Ut))-1);
obj=sum((fun - I).^2);
%create an optimized problem with the function obj
lsqproblem = optimproblem("Objective",obj)
%for the problem based appraoch, specify the initial point as a structure,with the variable names and fields of the structure
x0.c_01 = [870.8]
x0.m_1 = [1.2]
%Review the problem formulation
show(lsqproblem)
%solving problem using Isqnonlin
[sol,fval] = solve(lsqproblem,x0)
%Plot the resulting solution and original data
% figure
responsedata = evaluate(fun,sol);
plot(U,I,'r*',U,responsedata,'b-');
% plot(U,responsedata,'black--','DisplayName','responsedata')
legend('Original Data','Fitted Curve')
legend show
axis([0,0.6,0,3.5]);
xlabel('Spannung U');
ylabel('Strom A');
grid on;
% display solved c_01 value
disp(sol.c_01)
disp(sol.m_1)

Alan Weiss
Alan Weiss 2020 年 5 月 12 日
I would not write the sum of squares explicitly. Instead, formulate your problem as an EquationProblem and solve that. You can have five variables in the problem as easily as one. Of course, with just one equation and five variables, it is unlikely that there is a unique solution. But perhaps I misunderstand the problem.
Alan Weiss
MATLAB mathematical toolbox documentation

カテゴリ

Help Center および File ExchangeGet Started with Optimization Toolbox についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by