How to display the contour line values from a contour plot generated using the curve fitting tools?
Ältere Kommentare anzeigen
I created this 2D contour plot using sfit from the curve fitting tools app, and I am trying to have the values of each contour line displayed in the contour plot. I've gone through some other examples, but they only use the contour function, and not data generated from the sfit. Here is the generic code extracted from the CFtools:
%CREATEFIT(SCANTIME,DRUMHEIGHT,CORRECTEDDENSITY)
% Create a fit.
%
% Data for 'untitled fit 1' fit:
% X Input : Time
% Y Input : Location
% Z Output: Speed
% Output:
% fitresult : a fit object representing the fit.
% gof : structure with goodness-of fit info.
%
% See also FIT, CFIT, SFIT.
% Auto-generated by MATLAB on 29-Mar-2017 23:17:04
%%Fit: 'untitled fit 1'.
[xData, yData, zData] = prepareSurfaceData( Time, Location, Speed );
% Set up fittype and options.
ft = fittype( 'loess' );
opts = fitoptions( 'Method', 'LowessFit' );
opts.Normalize = 'on';
opts.Span = 0.05;
% Fit model to data.
[fitresult, gof] = fit( [xData, yData], zData, ft, opts );
% Make contour plot.
figure( 'Name', 'Loess Quadratic' );
h = plot( fitresult, [xData, yData], zData, 'Style', 'Contour');
set(h(2),'MarkerSize',0.0001);
legend(h, 'Loess Quadratic', 'Speed vs. Time, Location', 'Location', 'NorthEast' );
% Label axes
xlabel Time(min)
ylabel Location(in)
grid on
h = colorbar
Thank you in advance for the help.
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Get Started with Curve Fitting Toolbox finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
