How to get z for different x
1 次查看(过去 30 天)
显示 更早的评论
x = [-2:0.1:2];
z=x.*(1-x).*(2-x).*(4-x)/((6-x)-(1-x).*(x-7));
I am getting error. Please correct my problem.
2 个评论
采纳的回答
Wayne King
2012-12-18
编辑:Wayne King
2012-12-18
x = [-2:0.1:2];
z = x.*(1-x).*(2-x)./((6-x).*(x-7));
You just forgot a ./
Now you should have a vector
x = [-2:0.1:2];
z = x.*(1-x).*(2-x)./((6-x).*(x-7));
plot(x,z)
更多回答(2 个)
Thomas
2012-12-18
x = [-2:0.1:2];
z=x.*(1-x).*(2-x).*(4-x)./((6-x)-(1-x).*(x-7))
You missed the . before the division to do element by element division
0 个评论
Daniel Shub
2012-12-18
Presumably you want to use ./ instead of /, just like you are using .* instead of *
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Numeric Types 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!