How can I get MATLAB to keep variables that are in a range?
3 次查看(过去 30 天)
显示 更早的评论
I'm varying a vector to be crossed with another, but one of the values (angle) of the first vector [cos(a) sin(a) 0] X [cos(-0.4363) sin(-0.4363) 0]. The values of "a" must be varied from 0 to 180 and stored to be plotted on a graph. I've tried using the "for" function to get the values of the first vector but when I try to cross these values with the second vector I get an error stating that they are not the same size. Any help or tips would be appreciated.
0 个评论
回答(1 个)
Josh Meyer
2013-11-11
编辑:Josh Meyer
2013-11-12
Here is one way to do it- just store the vectors as columns in the matrices.
X = linspace(0,pi/2,1000);
N = length(X);
A = [cos(X); sin(X); zeros(1,N)];
B = [cos(-0.4363).*ones(1,N); sin(-0.4363).*ones(1,N); zeros(1,N)];
C = cross(A,B)
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Function Creation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!