Plotting Error (Very Simple Code)
1 次查看(过去 30 天)
显示 更早的评论
As part of practice of plotting, I made a very simple code, but it has an error. Would you check the code and explain on the problem so that I can make an correction?
x=1.0:0.2:2.0; y=2/x; plot(x,y)
Error using / Matrix dimensions must agree.
Error in Untitled6 (line 2) y=2/x;
0 个评论
采纳的回答
Walter Roberson
2018-2-3
y = 2./x;
The operation A/B is like A * inv(B) where * is algebraic matrix multiplication. You want element-by-element division, which is the ./ operator
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Line Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!