Placing Markers at Every Tenth Data Point and creating Label

18 views (last 30 days)
I understand that in order to place markers at every tenth data point I have to plot the data twice, e.g.,
x1 = 0:pi/100:2*pi;
x2 = 0:pi/10:2*pi;
plot(x1,sin(x1),'r:',x2,sin(x2),'r+')
But how do I create a label that would display both?
Thank you!
  1 Comment
dpb
dpb on 23 Sep 2014
What, specifically, do you mean by a label that would display both?
Have you tried
legend('A','B')

Sign in to comment.

Accepted Answer

Kelly Kearney
Kelly Kearney on 23 Sep 2014
If by label you mean a legend entry, I'd add a dummy line to use for labeling
x = 0:pi/100:2*pi;
y = sin(x);
h = plot(x, y, ':r', x(1:10:end), y(1:10:end), 'r+', NaN, NaN, ':r+');
legend(h(3), 'my label');

More Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!