spherical variogram model function help
1 回表示 (過去 30 日間)
古いコメントを表示
The variable ‘vdata’ that i loaded from my m file has two columns,the first is x and the second is y.I'm supposed to Use the nonlinear least-square tool ‘lsqcurvefit’ to estimate the two parameters ‘a’ and ‘c’, and fit a function of the form: y = c[1.5(x/a) - 0.5(x/a)^3] if x < a and y = c if x >= a
The optimum values for ‘a’ and ‘c’ are around 10 and 0.8 respectively. This is a vector minimization problem, so the initial values will be a 2-element vector.
My issue: I am supposed to write a function m-file to generate the spherical variogram using the equations above. in this prolem, y is sometimes a vector, and sometimes a scalar depending on the size of ‘a’—i have no idea how to even begin writing this. I am unsure what the variables a and c represent. any help would be appreciated on how to start writing this function
0 件のコメント
回答 (1 件)
Vandana Rajan
2017 年 2 月 28 日
Hi,
You may check the size and type of variables inside your code, before deciding on what action to perform.
Functions like ' isscalar ' and ' isvector ' can be used to find if a variable is a scalar or a vector. To find the type of a variable, you can use ' class ' function. Also, ' cell arrays ' can be used to store elements of varying size and type. Now, if you wish to pass varying number of input arguments to a function and output varying number of arguments from a function, you can use ' varargin ' and ' varargout ' respectively.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Interpolation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!