Clear Filters
Clear Filters

How to plot discrete points over a continuous curve?

21 views (last 30 days)
I am trying plot a theoretical curve along side discrete test points on the same plot. The idea is that the theoretical curve is a continuous function over a range, but the test points are only a few discrete points over the same range. (Think, continuous line over a few X's). How would I do this? I don't want to stretch the test point vector to the same length of the continuous curve by zero-padding because that adds a bunch of false X's to the plot. Conversely, shrinking the theoretical vector to the length of the test vector gives a very jagged, inaccurate theoretical curve. All I want to do is to include a few discrete marks on the same scale as the continuous theoretical curve.

Answers (1)

the cyclist
the cyclist on 2 Apr 2013
One of many possible ways:
xd = 2:5;
yd = 3:6;
xt = 1:0.01:6;
yt = xt + 1;
figure
hold on
plot(xd,yd,'.')
plot(xt,yt,'-')

Tags

Products

Community Treasure Hunt

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

Start Hunting!