How do I plot multiple vectors in a graph
12 次查看(过去 30 天)
显示 更早的评论
I have two vectors and I need them to plot together on the same graph.
Example:
A = [1,2,3,4,5,6]
B = [1,2,3,4,5,6]
Assuming that the X of the graph is the vector A, I need all the values of A to appear, in relation to a point of the vector B, which would be the Y, so the (x,y) would be:
(1,1),(2,1),(3,1),.....
So successively until vector B runs out.
(1.6), (2.6), (3.6), ....
0 个评论
回答(1 个)
Voss
2023-1-15
编辑:Voss
2023-1-15
Like this?
A = 1:6;
B = 1:6;
[Ap,Bp] = ndgrid(A,B);
plot(Ap,Bp)
2 个评论
Image Analyst
2023-1-15
编辑:Image Analyst
2023-1-15
You can also use
grid on
if you want them along tick marks.
另请参阅
类别
在 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!