How to work with unknown parameters using Nelder Mead Algorithm?

4 ビュー (過去 30 日間)
Julkar_Mustakim
Julkar_Mustakim 2020 年 1 月 3 日
編集済み: Julkar_Mustakim 2020 年 1 月 30 日
Dear All, I need to extract the original parameters of a PV Panel using Nelder-Mead Algorithm. How can I do that?
I also have the following equation:
Thank you and looking forward.

採用された回答

Walter Roberson
Walter Roberson 2020 年 1 月 3 日
Given a set of trial input parameters in a vector, use the known x values to project y values. Subtract the known y values in each case, and square those individually, and sum() the vector. The result will be a sum-of-squared-errors scalar for those input parameters. You want to minimize that: if there were a perfect fit, the residue would be 0. (The residue cannot be negative as you are adding values that are strictlly non-negative).
You can construct a function handle that given the trial parameters, calculates the residue scalar.
Now pass the function handle to your Nelder-Mead function for it to minimize.
  12 件のコメント
Walter Roberson
Walter Roberson 2020 年 1 月 30 日
[xMin] = NelderMead(myfunc,x0,alpha,beta,gamma,varargin)
varargin as a parameter would not typically occur outside of a function definition: in the majority of cases if you wanted to pass on parameters that you had received, you would use
[xMin] = NelderMead(myfunc,x0,alpha,beta,gamma,varargin{:})
Or is the
[xMin] = NelderMead(myfunc,x0,alpha,beta,gamma,varargin)
line intended to be a function definition that is missing the "function" keyword?
fval = feval(objfunc,smp,varargin{:});
what is objfunc and how does it differ from myfunc ?
Where is the end statement for your if fStd test? Where is the end statement for your while loop? Why are you setting up objF and x0 and so on inside the if inside the while ?
Julkar_Mustakim
Julkar_Mustakim 2020 年 1 月 30 日
編集済み: Julkar_Mustakim 2020 年 1 月 30 日
Dear Walter Roberson,
I have created seperate file for Nelder Mead and another file for my desired function like you guided me earlier. I have passed the Objective Function to the Nelder Mead Function. Here, "objfunc" means "myfunc". I have mistakenly written "objfunc". So here is the right one:
% objective function
myfunc = @(x)(1.5 - x(1,:)+ x(1,:).*x(2,:)).^2 ...
+ (2.25 - x(1,:) + x(1,:).*x(2,:).^2).^2 ...
+ (2.625 - x(1,:)+ x(1,:).*x(2,:).^3).^2;
and in the Nelder Mead File it will be like this:
fval = feval(myfunc,smp,varargin{:});
Initially, I will be deciding one of the stopping criteria if "fstd (standard deviation)" and "distv0 (which is the Absolute Relative Percentage Error considering the distance between the simplex and centroid)" is less than the tolerance.
if fStd < TOL && distv0 < TOL
break
end
But here, I was not able to calculate the "Absolute Relative Percentage Error () for Each of The Simplex (smp)". So please guide me on the calculation of Absolute Relative Percentage Error ( in my case it is becoming infinity).
distv0 = max(max(abs(repmat(v0,1,N)-smp(:,2:end))))./max(abs(repmat(v0,1,N));

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeNaNs についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by