Plotting with arrays, no graph displayed
1 次查看(过去 30 天)
显示 更早的评论
x = [6000,9375];
y = 10;
plot(x,y,'red')
title('x by y')
xlabel('x')
ylabel('y')
0 个评论
采纳的回答
Star Strider
2023-3-12
Plotting one point requres a marker, and plotting a line requires at least two vectors of the same size.
Two options, depending on the result you want —
x = [6000,9375];
y = 10;
figure
plot(x,y,'pr')
title('x by y')
xlabel('x')
ylabel('y')
x = [6000,9375];
y = 10*ones(size(x));
figure
plot(x,y,'red')
title('x by y')
xlabel('x')
ylabel('y')
And of course, you can plot both markers and lines of various kinds connecting them.
.
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!