MATLAB: How to plot points on a graph along with the smoothed values

MATLABplotsmoothing

I am able to plot points on a graph, but when I apply smoothing I am unable to plot the same points in my graph.
I tried to use filters and also tried changing span values. Is there any other way to plot points on a non-linear graph?

Best Answer

You want to plot them both, either using hold on between plots, or in the same plot command.
original_x = [1.0 2.0 3.0];
original_y = [4.0 5.1 6.0];
smoothed_x = [1.0 1.5 2.0 2.5 3.0]; %get these how you want

smoothed_y = [4.0 4.5 5.0 5.5 6.0]; %get these how you want
plot(original_x, original_y, 'ro', smoothed_x, smoothed_y, 'b-')