[英]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.