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

5 views (last 30 days)
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))

Accepted Answer

VBBV
VBBV on 19 Sep 2021
Edited: VBBV on 19 Sep 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

More Answers (0)

Categories

Find more on Mathematics in Help Center and File Exchange

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!