Problem about plotting 2D about multiple of functions

1 次查看(过去 30 天)
Hi.
I started Matlab recently. I wanted to draw this graph but Matlab always say this error.
x = 0:pi/100:6*pi;
y = floor(sin(x)) * floor(x);
plot(x,y);
Error using *
Inner matrix dimensions must agree.
Is it possible to help me? I'm sorry for bad English too.
Thanks.

采纳的回答

Mischa Kim
Mischa Kim 2016-12-6
编辑:Mischa Kim 2016-12-6
Amin, use instead
y = floor(sin(x)) .* floor(x); % notice the period before the *
This allows you to do element-wise multiplication.
  1 个评论
Amin Bor
Amin Bor 2016-12-7
Thanks for answer. I have another question. when I draw a graph like my graph in my question It's like this. my problem is that the circle that I showed is only one point and there is no line between this point and my graph but Matlab joint this points with a line to my graph. Is it possible to change this property? Thanks again.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by