简体   繁体   English

如何在Matlab中绘制3x2矩阵的跨度?

[英]how can I plot the span of a matrix 3x2 in matlab?

I tried this way: 我这样尝试:

    gl1 =
   -2.5000   -1.0000
    4.3301    1.7321
    0         0
syms a b
span=gl1(:,1)*a+gl1(:,2)*b
a=[-100:0.1:100];
b=[-100:0.1:100];
span=eval(span)

and then I'd do plot3(span). 然后我要做plot3(span)。 unfortunatly at the last row it gives me this error: 不幸的是,在最后一行它给了我这个错误:

Error using vertcat
Dimensions of matrices being concatenated are not consistent.

Error in sym/eval (line 11)
s = evalin('caller',vectorize(map2mat(char(x))));

any idea? 任何想法? I've found someone using a polytope method to do it,but I have no idea where I can get or I how can I realize such method. 我发现有人使用多面体方法来进行此操作,但我不知道该从哪里获得或如何实现这种方法。

thanks you in advice. 谢谢你的建议。

edit:in this case the span should be a line,since the rank of my matrix is one,but the question stands for a matrix with rank 2. 编辑:在这种情况下,跨度应该是一条线,因为我的矩阵的秩是1,但是问题代表矩阵的秩是2。

Why use symbolics? 为什么要使用符号? This works like a charm: 这就像一个魅力:

gl1 =
   -2.5000   -1.0000
    4.3301    1.7321
    0         0

a=[-100:0.1:100];
b=[-100:0.1:100];

span=gl1(:,1)*a+gl1(:,2)*b

Remember that you need several inputs to plot3 , ie the x, y, and z-values. 请记住,您需要对plot3多个输入,即x,y和z值。 Thus it should be something like this: 因此应该是这样的:

plot3(span(1,:),span(2,:),span(3,:)) 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在Matlab中绘制由9个75x矩阵组成的矩阵,该矩阵由15个具有5个不同变量的数据集组成,并使用不同的颜色? - How can I plot a 9x75 matrix consisting of 15 data sets with 5 different variables using different colors in Matlab? 如何使用Matlab从矩阵绘制网络图 - How can I use Matlab to plot a network graph from a Matrix 如何在Matlab中仅绘制对称矩阵的实特征值? - How can I plot only real eigenvalues of symmetrical matrix in matlab? 如何在Matlab中找到X矩阵的元素? - How can I find the elements of the X matrix in Matlab? 如何在Matlab中对轴图进行循环移位? - How can I do a cyclic shift for a x y plot in matlab? MATLAB:如何使用带有矩阵输入的plot()指定线属性? 即plot([x1 x2 x3],[y1 y2 y3]) - MATLAB: How Do I Specify Line Properties using plot() w/ Matrix Input? i.e. plot([x1 x2 x3],[y1 y2 y3]) 如何在MATLAB中轻松构建Levi-Civita 3x3x3矩阵? - How can I form a Levi-Civita 3x3x3 matrix easily in MATLAB? 如何用Matlab绘制字符矩阵? - How to plot character matrix with Matlab? 如何在Matlab中为矩阵中的每一列绘制一条线? - How do I plot a line in Matlab for every column in a matrix? MATLAB:尝试在3x2子图中添加共享的xlabel,ylabel - MATLAB: Trying to add shared xlabel,ylabel in 3x2 subplot
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM