MATLAB: I am plotting the moving median of the result of a for loop, but it is plotting multiple lines

movmedian

My code goes something like this
hold on
For i = 1:end;
result(i)= calc;
median = movmedian(result,10);
plot(i,median);
end
As the median is calculated, multiple lines are being plotted, proportional to the moving median range I'm using… any ideas?

Best Answer

Figured it out,
Just needed to plot the value of median i.e.
plot(i,median(i),'or')