What is problem to make space curve [2*cos(t),2*sin(t),5]?
2 次查看(过去 30 天)
显示 更早的评论
>> t = 0:pi/10:pi;
>> plot3(2*cos(t),2*sin(t),5)
Error occurred while using: plot3
Vectors should be the same length.
What should I do?
0 个评论
采纳的回答
Steven Lord
2020-6-1
You want to draw this curve in the section of 3-d space in the plane z = 5? You need to specify one z coordinate for each coordinate in x and y. plot3 doesn't do scalar expansion like many other functions do.
>> t = 0:pi/10:pi;
>> plot3(2*cos(t),2*sin(t),repmat(5, size(t)))
更多回答(1 个)
Image Analyst
2020-6-1
Not sure what the 5 is for, but maybe you mean this, using plot3() to plot a 3-D curve:
t = 0 : pi/10 : pi;
plot3(t, 2*cos(t),2*sin(t), 'b.-', 'LineWidth', 2, 'MarkerSize', 20)
grid on;
xlabel('t', 'FontSize', 15);
ylabel('y', 'FontSize', 15);
zlabel('z', 'FontSize', 15);
or maybe you mean this, using plot() to plot a 2-D curve:
t = 0 : pi/10 : pi;
plot(2*cos(t),2*sin(t), 'b.-', 'LineWidth', 2, 'MarkerSize', 20)
grid on;
xlabel('t', 'FontSize', 15);
ylabel('y', 'FontSize', 15);
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!