who can help me solve the error appearing in matlab cftool
1 view (last 30 days)
Show older comments
e+a.*((c-1)./c).^((1-c)./c) .* ((x-d)./b+((c-1)./c).^(1./c).^(c-1)) .* exp(-(x-d)./b+((c-1)./c).^(1./c).^c+(c-1)./c)
I use this function to make curve fittiing,but in matlab cftool appears this error:Ignoring NaNs in data. Complex value computed by model function, fitting cannot continue. Try using or tightening upper and lower bounds on coefficients.
I get this function from the sigmaplot curve fitting report:
Data Source: Data 1 in Notebook1 Equation: Peak, Weibull, 5 Parameter
f = if(x<=x0-b*((c-1)/c)^(1/c),
y0,
y0+a*((c-1)/c)^((1-c)/c) * (abs((x-x0)/b+((c-1)/c)^(1/c))^(c-1)) * ...
exp(-abs((x-x0)/b+((c-1)/c)^(1/c))^c+(c-1)/c))
this is the function that I used ,I just remove abs
R Rsqr Adj Rsqr Standard Error of Estimate
0.9425 0.8882 0.8868 3.0055
Coefficient Std. Error t P
a 29.1202 0.6399 45.5066 <0.0001
b 1.1594 0.0280 41.4211 <0.0001
c 1.5093 0.0413 36.5247 <0.0001
x0 6.1068 0.0252 241.9026 <0.0001
y0 2.2064 0.2053 10.7457 <0.0001
I also attach the original data
0 Comments
Answers (1)
dpb
on 18 Aug 2014
Edited: dpb
on 18 Aug 2014
f = if(x<=x0-b*((c-1)/c)^(1/c),
y0,
y0+a*((c-1)/c)^((1-c)/c) * (abs((x-x0)/b+((c-1)/c)^(1/c))^(c-1)) * ...
exp(-abs((x-x0)/b+((c-1)/c)^(1/c))^c+(c-1)/c))
...this is the function that I used ,I just remove abs
Well, you did quite a lot else besides -- you removed the x<=x0... conditional section, as well as the abs()
I don't know SigmaPlot syntax, but just guessing I'd translate the above as
if x <= x0-b*((c-1)/c)^(1/c)
f=y0;
else
f=y0+a*((c-1)/c)^((1-c)/c) * ...
(abs((x-x0)/b+((c-1)/c)^(1/c))^(c-1)) * ...
exp(-abs((x-x0)/b+((c-1)/c)^(1/c))^c+(c-1)/c));
end
in Matlab.
Don't believe cftool has the flexibility for such a model with the conditional in it; you'll have to use one of the more sophisticated nonlinear fitting tools in Matlab.
0 Comments
See Also
Categories
Find more on Get Started with Curve Fitting Toolbox 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!