error window to a model function after nlinfit
显示 更早的评论
Hi I use nlinfit to fit an equation to a model, and get the value of the parameter with its associated error. Now I want to use this parameter with its error and plot another function, which should show the error region as well! For example: Equation 1: y=Acos(x)+Bsin(x) is fitted using nlinfit to give this. A=5 +- 0.1 B=3+-0.2 Now I want to use these values of A and B (with errors) to plot a function Y+-delY=(A+-delA)cosx +(B+-delB)sinx where del is the error .
Thanks
采纳的回答
更多回答(2 个)
Star Strider
2017-3-14
1 个投票
You have used the nlparci function to get the parameter confidence intervals.
The correct way to do what you want, that is to express the errors in the fit with respect to your data, is to calculate the confidence intervals on the prediction with the nlpredci function. That will give you the correct statistical result. It is also much more straightforward to implement.
The initially accepted answer is incorrect.
2 个评论
DebiPrasad
2017-3-14
Star Strider
2017-3-14
Hi Debi,
The nlinfit function does not allow you to constrain the parameters. The lsqcurvefit function does.
If you have the Optimization Toolbox, see if using the lsqcurvefit function with constraints on the parameter you want to limit will give you an acceptable fit to your data. I believe you can use nlparci and nlpredci with constrained parameter estimation outputs returned by lsqcurvefit, and I see nothing in the documentation for either function that indicates it would not be appropriate. (I know you can use them with lsqcurvefit with unconstrained parameters.)
类别
在 帮助中心 和 File Exchange 中查找有关 Gaussian Process Regression 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
