Can you set the name for a fit when you call the cftool(x,y) gui?
6 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I'm fitting a large number of curves manually from an existing data set (essentially I have them plotted and am going through and looking visually for candidates for power law fits, sometimes only small segments of plots). My code then rips the data out from the existing figure (visible ones only), does some other processing, then dumps the x,y data to the curve fitting toolbox so I can look at/exclude/fit regions depending on how they look (they are not simply straight lines, and the exclusion region changes dynamically each time so its not easy to fit from the command line).
Anyway, all I would like to be able to do is set the fit name at the command line as I add each fit to the gui, but I can't figure out how. Or if it's even possible, I remember searching a few months back, but I just gave up and did it by hand. As there are dozens of sets to fit and the names are a bit convoluted it'd be nice to have a quicker way to do it.
0 Commenti
Risposta accettata
David Sanchez
il 2 Set 2013
You can not do it with cftool, but you can code it instead usign fit, like this:
Fit = 'my_fit';
[xData, yData] = prepareCurveData( x, y ); % x/y is your data
% Set up fittype and options.
ft = fittype( 'poly1' ); % choose a different type i
opts = fitoptions( ft );
% Fit model to data.
[fitresult, gof] = fit( xData, yData, ft, opts );
% Plot fit with data.
figure( 'Name', Fit );
h = plot( fitresult, xData, yData );
legend( h, 'y vs. x', Fit, 'Location', 'NorthEast' );
% Label axes
xlabel( 'x' );
ylabel( 'y' );
grid on
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Linear and Nonlinear Regression in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!