Error in plotting line and scatter in the same plot, for filtered data and original data

1 Ansicht (letzte 30 Tage)
Hi! I have a problem in plotting my data. I have a table consist of date and value, let's call it respectively t and x. I have filtered x and got only several value out of x data (call it y1), for example I have 54 data in x, and I only have 9 data in y1. However, y1 is the part of x.
I want them to be plotted in the same graph, line for x data, and scatter for y1 data. They both should be plotted over t. Here is my code:
figure(3)
x=flowtable.Durchflusslm;
t=flowtable.DateAndTime;
pf=peakflow;
y1=filter(pf,x);
plot(t,x,t,y1)
xlabel('Date and Time')
ylabel('Flow (m3/h)')
legend('Flow','Peak Flow')
However, I got an error "Error using filter. Not enough input arguments." Do you know why I got this problem? I look at the example on the web, it should work. Or maybe because they have different size of t as x-axis? But y1 is the part of x. I got stuck here. Could you please help me? Thank you in advance.

Antworten (1)

KSSV
KSSV am 26 Okt. 2017
Read the documentation of filter https://in.mathworks.com/help/matlab/ref/filter.html. It needs three variables as input and you are providing only two inputs.

Kategorien

Mehr zu Graphics Objects finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by