why do i get the error: matrix dimensions must agree ??
1 次查看(过去 30 天)
显示 更早的评论
this is what I'm trying to plot
x=linspace(0,100,100);
a=5;
y=1/(abs(a*x)+1);
figure
plot(x,y)
how do I fix this error?
0 个评论
采纳的回答
Mischa Kim
2014-9-29
编辑:Mischa Kim
2014-9-29
Maria, use
y = 1./(abs(a*x) + 1);
instead. Notice the dot right after the "1". This so-called elementwise division is necessary because x is a vector. See the documentation for more detail.
0 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!