How to display the contour line values from a contour plot generated using the curve fitting tools?
古いコメントを表示
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.
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Get Started with Curve Fitting Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
