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!