How do I list only i values of a cross product in a plot.
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Sohail Ayazi
am 18 Sep. 2021
Kommentiert: Sohail Ayazi
am 19 Sep. 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))
0 Kommentare
Akzeptierte Antwort
VBBV
am 19 Sep. 2021
Bearbeitet: VBBV
am 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
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!