Error in plotting line and scatter in the same plot, for filtered data and original data
2 次查看(过去 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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Scatter Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!