Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

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

1 visualización (últimos 30 días)
y = ((coeff(1)./x)+(coeff(2)^2)./(x.^2))*(fitParameter); % but fitParameter also depends on vector x
  7 comentarios
darova
darova el 3 de Mayo de 2020
What about tihs?
p = polyfit(X,Y,1);
Y1 = polyval(p,X);
plot(X,Y,'.r',X,Y1)
legend('data','fit')
Matteo Masto
Matteo Masto el 4 de Mayo de 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!!

Respuestas (1)

Image Analyst
Image Analyst el 3 de Mayo de 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.
  2 comentarios
Matteo Masto
Matteo Masto el 3 de Mayo de 2020
Editada: Matteo Masto el 3 de Mayo de 2020
thanks, but the problem is that the parameter depends on x in a way that I don't know a priori, I don't know which is that SomeFunctionOf(x)
Image Analyst
Image Analyst el 3 de Mayo de 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?

Productos


Versión

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by