MATLAB: Evaluate a function at a number of x values

findplotting

I have a vector x:
x=linspace(0,793,10000)
I also have a vector y that is the same size as x. I plotted y vs x to come up with a line graph.
plot(x,y)
Now, I also have a vector of x values:
a=[3,3.12,5.7,9]
and I want to put markers on the line graph at those values of x. What would be the best way of doing this? I've been trying to use the "find" function, but I've beeen having some difficulties.
Thanks in advance!!

Best Answer

interp1(x, y, a, 'linear')
are the appropriate y coordinates corresponding to the x coordinates in "a".
Related Question