How can I get MATLAB to keep variables that are in a range?

3 visualizaciones (últimos 30 días)
Donald
Donald el 1 de Oct. de 2013
Editada: Josh Meyer el 12 de Nov. de 2013
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.

Respuestas (1)

Josh Meyer
Josh Meyer el 11 de Nov. de 2013
Editada: Josh Meyer el 12 de Nov. de 2013
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)

Categorías

Más información sobre Function Creation en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by