Azzera filtri
Azzera filtri

Inconsistency in the fitted curve and the plot of obtained fitting parameters

1 visualizzazione (ultimi 30 giorni)
I am trying to fit an equation to a model and I need to call a function "kkrebook2" in my fit type funtion (For "kkrebook2", the inputs are two vectors and its output is a vector). I have attached the way I call "kkrebook2" in my fit type function. When I run my fit code I see the obtained fitted curve (red figure) is different from the plot of the fit type function by using the obtained fitting parameters (yellow figure) which doesn't make sense. This is what I see:
This is the snippet of my fit type function code where I call "kkrebook2" function.
function p = SCR(nu,numGaussians,a,center,sigma)
for i = 1:length(nu)
for k = 1 : numGaussians
if k==1
b = Start;
b = Start + (center * (k-1));
thisGaussian(i) = a.*exp(-((nu(i)-b).^2)/(2.*(sigma.^2)));
% Add into accumulator array:
gaussEqn1(i) = gaussEqn1(i) + thisGaussian(i);
z(i)= gaussEqn1(i);
Rn = kkrebook2(nu,z,0);
for i = 1:length(nu)
hi2(i) = (4*pi*n.*nu(i)*L)/c;
h(i)= f(i)./g(i);
m(i)= abs(h(i));
p(i)= (m(i).^2);
I have also attached "kkrebook2" function that I call in my code.
Could you please let me know where is the problem? I think it should be in the way I am calling "kkrebook2" but I cannot capture it.
Thanks in advance!
  4 Commenti

Accedi per commentare.

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by