This question is closed. Reopen it to edit or answer.

how can I extract a fit parameter, that depends on the independent variable, as a vector of that variable? Thanks a lot!

1 view (last 30 days)
y = ((coeff(1)./x)+(coeff(2)^2)./(x.^2))*(fitParameter); % but fitParameter also depends on vector x
Matteo Masto
Matteo Masto on 4 May 2020
no, sorry I have to use that precise function. But sorry again I found that the problem was another one and now I solved. Thanks again!!

Answers (1)

Image Analyst
Image Analyst on 3 May 2020
Try this:
fitParameter = SomeFunctionOfX(x); % Returns a vector the same length as x.
term1 = coeff(1) ./ x;
term2 = coeff(2) ^ 2 ./ (x. ^ 2);
% Compute formula. Note: term1, term2, and fitParameter all depend on vector x.
y = (term1 + term2) .* fitParameter;
You, of course, have to define SomeFunctionOfX() since we don't know what it is.
Image Analyst
Image Analyst on 3 May 2020
What made fitParameter? Is it a scalar (one value for all x) or vector with one value for every value of x in hte x vector?




Community Treasure Hunt

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

Start Hunting!

Translated by