Changing the polynomial coefficients
Show older comments
Hey there, So I have a signal and I fitted a Gaussian model with 8 peaks which results in a total of 24 parameters. I would like change the fitted model coefficients with a small variance to see the change in the fitted model. And I want to this for all of the 24 parameters iteratively in a loop. I know how to extract the coefficient values and names. Fitted model looks like;
a1*exp(-((x-b1)/c1)^2) + a2*exp(-((x-b2)/c2)^2) +
a3*exp(-((x-b3)/c3)^2) + a4*exp(-((x-b4)/c4)^2) +
a5*exp(-((x-b5)/c5)^2) + a6*exp(-((x-b6)/c6)^2) +
a7*exp(-((x-b7)/c7)^2) + a8*exp(-((x-b8)/c8)^2)
Just a simple code;
>> [fitresult, gof] = fit( xData, yData, ft, opts );
>> cVals = coeffvalues(fitresult);
>> cNms = coeffnames(fitresult); % Cell
>> fitresult.cNms{1} = 1;
When I try to do this I get the following error;
"The name 'ss' is not a coefficient or a problem parameter. You can only use dot notation to access the coefficients and problem parameters of a cfit or sfit, e.g., 'f.a1'."
So my question is how can I do that without manually entering all the coefficients name like "a1", "a2" and do it automatically?
Thanks in advance,
Baris
Accepted Answer
More Answers (0)
Categories
Find more on Linear and Nonlinear Regression in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!