Error in plotting line and scatter in the same plot, for filtered data and original data
1 回表示 (過去 30 日間)
古いコメントを表示
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.
0 件のコメント
回答 (1 件)
KSSV
2017 年 10 月 26 日
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.
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!