How do I list only i values of a cross product in a plot.

2 visualizaciones (últimos 30 días)
Sohail Ayazi
Sohail Ayazi el 18 de Sept. de 2021
Comentada: Sohail Ayazi el 19 de Sept. de 2021
I am totally new to MATlab, I need to plot a cross product that contains a variable. The variable ranges from -15 to 15. I wanted to plot the i,j, and k values of the cross product separately on the domain -15 to 15. What function would I use for this. This is what I tried to do. I apologize for any errors in formatting this question.
x=-15:15;
for i= 1:length(x)
C=[0,0,30];
B=[x(i),0,30];
A=[0,40,30];
O=[0,0,0];
rOA=A-0;
rAB=B-A;
MagTAB=875;
MagAB=sqrt(dot(rAB,rAB));
LAB=rAB/MagAB;
TAB=MagTAB*LAB;
A=cross(rOA,TAB);
end
plot(x(i),A(:,:,1))

Respuesta aceptada

VBBV
VBBV el 19 de Sept. de 2021
Editada: VBBV el 19 de Sept. de 2021
%if true
x=-15:15;
for i= 1:length(x)
C=[0,0,30];
B=[x(i),0,30];
A=[0,40,30];
O=[0,0,0];
rOA=A-0;
rAB=B-A;
MagTAB=875;
MagAB=sqrt(dot(rAB,rAB));
LAB=rAB/MagAB;
TAB=MagTAB*LAB;
A(i,:)=cross(rOA,TAB); plot(x(1:i),A,'bo','linewidth',1.5);
hold on;
end
Try this way

Más respuestas (0)

Categorías

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

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by