labelling the (x,y) values corresponding to each data points on a graph
2 views (last 30 days)
Show older comments
Hi, This is the code for plot. There are around 9 data points. I want the x and y values to be displayed at each point on the curve. For example, at first point, display as '(0,1.0000)', second point, '(15,0.9563)' and so on.
load=[ 0 15 20 25 30 35 40 45 50];
Corr=[ 1.0000 0.9563 0.9419 0.9299 0.9166 0.9152 0.9085 0.8957 0.8881];
[xData, yData] = prepareCurveData( load, corr );
ft = fittype( 'smoothingspline' );
[fitresult, gof] = fit( xData, yData, ft );
figure( 'Name', 'Correlation Coeff Vs Deflection' );
h = plot( fitresult, xData, yData ,'*k');
Thanks in advance
athira
0 Comments
Accepted Answer
KL
on 29 Mar 2017
Hi Athira,
xOffsets = 0.0025*ones(1,9);
yOffsets = 0.0025*ones(1,9);
for i=1:9
text(load(i)+xOffsets(i), corr(i)+yOffsets(i), [num2str(load(i)) ',' num2str(corr(i))]);
end
More Answers (0)
See Also
Categories
Find more on Annotations 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!