spherical variogram model function help
조회 수: 6 (최근 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에서 Boundary Conditions에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!