Finding Unknown X from Known Y with cftool
Show older comments
Hello all,
Very very new matlab user here. I seem to be able to muddle my way around the software and I have the curve fit toolbox. I have gone through the help activities and seem to be stumped on what to do after I have fit a curve to my data. I do see that an equation for my fit is generated in the results area, but how do I use this in an automated fashion? I was hoping that after generating fit I could somehow enter a Y axis value and have matlab find me the answer (X), withouth having to do it manually. I can't seem to get any of the post processing formulas to give me data that even remoting makes sense. Thanks for your help!
1 Comment
the cyclist
on 25 May 2012
It would be helpful if you gave more details about exactly which MATLAB functions you have used to generate the fit. If you can provide a small code sample as an example, that's the best.
Accepted Answer
More Answers (1)
Sean de Wolski
on 25 May 2012
First: This a good question. +1.
After you're done fitting with the CFTOOL go to "fit">"Save to Workspace". This will then generate an object called fittedmodel (or whatever you choose to name it in the dialog). To use this on other data:
y2 = fittedmodel(x2);
More Small example:
x = 1:10;
y = (1:10)+randn(1,10)+3; %noisy y (nominally: y = x+3)
cftool(x,y)
%Make model and save fitted model
%Now run:
x2 = 10:20;
y2 = fittedmodel(x2);
4 Comments
Andrew Wheeler
on 25 May 2012
Sean de Wolski
on 25 May 2012
see addendum
Andrew Wheeler
on 25 May 2012
Sean de Wolski
on 25 May 2012
Maybe I'm underestimating this, but why don't you just switch the inputs?
Categories
Find more on Get Started with Curve Fitting Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!