CFTool: how to get output and use those data
24 views (last 30 days)
I have a signal which I want to "flatten":
There are specific points I select (too complicated to explain why, just trust that I have to select these points):
so when they are superimposed you can see how the selected points mirror the original signal:
I then use CFTool and "smoothing spline" model to get the smoothed curve through the selected points:
My QUESTION is: how can I now get the x,y points from the CFTool so that I can go back to my original data (stored as an array) and subtract the smoothed curve from the original data and thereby "flatten" the signal. In short, I have created a smoothed "baseline" using CFTool which I want to subtract from the original signal.
I can't figure out how to get these x,y, data out from CFTool. The command "Save to Workspace" generates obscure parameters in my workspace. The MatLab CFTool help is too opaque for me. Is there an easy tutorial for this or better still, do you have an easy explanation?
dpb on 13 Jun 2017
I'll grant the CF Tool is really opaque in many ways, fer shure...this is perhaps the most of the many dark corners...
When you save the fit to workspace you're given the opportunity to name the fit object and some other data. For a smoothing spline example I just used SS for the object and SSout for the residuals object.
To use it, with the x vector you have, simply
ySS=SS(x); % evaluate the cfit at x
The content of SS is a fit object; the particulars within such an object are dependent on the type of fit. The information within the cfit object can be accessed from
SSstruct=coeffvalues(SS); % a structure holding the fit object info
breaks: [1x101 double]
coefs: [100x4 double]
for the one I did with some data here.
See the doc section "Fit Postprocessing" under the 'cfit' documentation to get to the more detailed explanations.
Hopefully that'll get you started.. *)
Feel free to ask more detailed and attach the actual data/object if still have trouble.