Comments in code for orientation not clear

2 ビュー (過去 30 日間)
YASSER
YASSER 2024 年 2 月 24 日
編集済み: Yash 2024 年 9 月 5 日
Dear Sirs
I've got a matlab code to use for PV parameter estimation
My problem is that the code seems to be not complete or need some specification from me
The author developper write some comments as orientation in order to add inputs but it is vague
Can anyone try to translate the comment or the intention of it ?
% Parameter Extraction from least-square fitting
% Numerical Differentiation is performed using Quasi-Newton Line Search
% ------------------------------------------------------------------------
% ---------------------------Output generated-----------------------------
% res.iter: nIter - Total number of iterations
% res.v: Least Square cost function vector [1 x nIter]
% res.delv: Gradient column vector [1 x nIter]
% res.aold: Parameters [nPara x (nIter + 1)]
% res.dela: Delta paramters [nPara x nIter]
% res.normDelCheck: || dela/a ||_2 [1 x nIter]
% ------------------------------------------------------------------------
% ------------------------------------------------------------------------
% Pragya Sharma, March 30 2017
% ps847@cornell.edu
% ------------------------------------------------------------------------
function [res] = paraExtractLS(par)
% --------------------Set up needs input from user--------------------
% par.sMeas: Measurement data
% ---------- last column: Output variable
% ---------- First to (last - 1) columns: Variables
% par.sMod: Function handle to Model function
% par.a0: Initial parameter input column vector
% par.h: Numerical differentiation step size column vector
% par.mode:
% ---------'QN': Quasi-Newton
% -------------: Can insert your own Numerical Differentiation Method
% par.maxIter: Maximum number of iterations
% par.ls: Line Search Yes or No
% par.tol: Tolerance on converging condition
% --------------------------------------------------------------------
% --------------------------------------------------------------------
% Setting up problem
  2 件のコメント
Walter Roberson
Walter Roberson 2024 年 2 月 24 日
The comments describe the expected input par -- it is expected to be a struct with the given fields, sMeas, sMod, a0, h, mode, maxIter, ls, and tol
YASSER
YASSER 2024 年 2 月 25 日
So this mean that the author is expecting from the user to enter these inputs without clarifying what does it mean exactly ?

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

採用された回答

Yash
Yash 2024 年 9 月 3 日
編集済み: Yash 2024 年 9 月 5 日
Hi Yasser,
Based on the comments in your MATLAB code, it seems like the author has provided a framework for parameter extraction using a least-square fitting method. The comments indicate where you need to provide specific inputs or configurations. The input "par" should be a struct with the given fields, sMeas, sMod, a0, h, mode, maxIter, ls, and tol.
Inputs Required from User:
1. Measurement Data (par.sMeas): This should be a matrix where:
  • The last column contains the output variable (the dependent variable you are trying to model).
  • The first to the second-to-last columns contain the independent variables (the inputs to your model).
2. Model Function (par.sMod): This should be a function handle to your model function. The model function should take the independent variables and parameters as input and return the predicted output.
3. Initial Parameters (par.a0): A column vector containing initial guesses for the parameters you want to estimate. These are the starting points for the optimization process.
4. Numerical Differentiation Step Size (par.h): A column vector specifying the step size for numerical differentiation. This is used to approximate the gradient of the cost function.
5. Mode (par.mode): A string indicating the method for numerical differentiation. The default is 'QN' for Quasi-Newton. You can specify another method if desired.
6. Maximum Iterations (par.maxIter): An integer specifying the maximum number of iterations the algorithm should perform.
7. Line Search (par.ls): A boolean or string indicating whether to use line search during the optimization. Specify 'Yes' or 'No'.
8. Tolerance (par.tol): A small positive number specifying the convergence tolerance. The algorithm will stop if the change in parameters is less than this value.
I hope this helps!

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by