Using Levenberg-Marquardt algorithm in the optimization
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
How can I use the optimization tool preferable to find a given value in an equation. This is the main equation I=i_ph-Is.*(exp(U./(m_1*Ut))-1) and I have a IU curve, but i want to get the value of 'c_01' in the sub equation Is=c_01*T^(3)*exp((-e_g*eV)/(k*T)).
채택된 답변
Robert U
2020년 4월 23일
Hi RAPHAEL OWENS,
there are several solvers and methods available. One of the available functions in Matlab is lsqcurvefit(). Below there is a sketch of how to apply the function on your (supposedly) available data.
% known parameters
T
e_g
eV
k
i_ph
m_1
Ut
% underlying equation
Is = @(c_01) c_01 * T^3 * exp((-e_g*eV)/(k*T));
I = @(c_01,U) i_ph - Is(c0_1) .* (exp(U./(m_1*Ut))-1);
% start value(s) for optimization
c_01_guess = 1;
% 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_measured,I_measured,[],[],opt);
Kind regards,
Robert
댓글 수: 9
Thank for your quick response Robert. I still need more clarity. I attached the data and formula here. I want to optimize the value of c_01 using a guess value of 870.80. The plot of the graph is also shown.
Also i read that using the levenberg-marquardt algorithm, I'll have to use the fsolver.

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;
Is=c_01*T^(3)*exp(-((e_g*e)/(k*T)));
I=i_ph-Is.*(exp(U./(m_1*Ut))-1);
plot(U,I,'linewidth',2.5);
axis([0,0.6,0,3.5]);
xlabel('Spannung U');
ylabel('Strom A');
grid on;
Explicit code for the described case:
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;
% underlying equation
Is = @(c_01) c_01 * T^3 * exp((-e_g*e)/(k*T));
I = @(c_01,U) i_ph - Is(c_01) .* (exp(U./(m_1*Ut))-1);
fh = figure;
ah = axes(fh);
hold(ah,'on');
plot(ah,U,I(170.8,U),'xblack','DisplayName','real curve');
plot(ah,U,I(870.80,U),'--black','DisplayName','guessed curve');
legend show
% start value(s) for optimization
c_01_guess = 870.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),'-black','DisplayName','optimization result curve');
axis(ah,[0,0.6,0,3.5]);
xlabel('Spannung U');
ylabel('Strom A');
grid on;
Can you give more clarity on the bold curly bracket in first and second equation and also the entire last equation*
Is = {@ (c_01)} c_01 * T ^ 3 * exp ((- e_g * e) / (k * T));
I = {@ (c_01, U)} i_ph - Is (c_01). * (Exp (U ./ (m_1 * Ut)) - 1);
c_01_opt = lsqcurvefit (I, c_01_guess, U, I (170.8, U), [], [], opt);
Kind regards,
Raphael
The equations you gave are formulated as anonymous functions. The free parameters are defined as function inputs. It seemed to be advantagous to define two equations to not expand the main equation too much.
According to lsqcurvefit()-documentation the model function has to be given in the form f(x,xdata) where x is the vector of free parameters.
Calling lsqcurvefit() with options requires to give lower and upper limits parameters. Since we do not want to limit our solution space, we input empty parameters. The result is the optimized free parameter value.
Kind regards,
Robert
Thanks alot Robert
Hello Robert, how do i use the optimization tool under the APP taskbar to solve this problem.
I don't know that tool. You can ask a new question in the forum. I am sure that someone can elaborate on that.
Kind regards,
Robert
Hallo Robert, I need further clarity. How can i get the value of a parameter using optimization.
I=i_ph - (c_01 * T^3 * exp(-((e_g*e)/(k*T)))) .* (exp(U./(m_1*Ut))-1);
The parameter is c_01
The real value of c_01 is 170.8
So the optimized value will be also the real value.
Can you kindly break down the explanation also, because the genral idea is to get a parameter when we are just given the vectors that makes up the curve.
If we were just given UI value and the curve, and also some constants, how will i get an X parameter.
I hope my question is clear enough. Thanks
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
I=i_ph - (c_01 * T^3 * exp(-((e_g*e)/(k*T)))) .* (exp(U./(m_1*Ut))-1);
Hi RAPHAEL OWENS,
I am not sure whether I understood your question correctly: Where do I acquire xdata and ydata on real data?
Usually you are measuring the U-I-curve by supplying U and measuring I. In that case the real data are "U" (xdata) and "I" (ydata). The grid does not matter since you are trying to fit the data to a model function. It just needs to be fine enough to cover the overall model function characteristics.
In a nutshell:
- Supply U (xdata)
- Measure I (ydata)
- Give known parameters
- Fit to model funcion.
Kind regards,
Robert
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Linear Programming and Mixed-Integer Linear Programming에 대해 자세히 알아보기
태그
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
