plotting vector in matlab
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello,I have the following code to represent vectoric components of E-field.
The field has X and Y directions, as you can see in the photo I got a plot of two of the components.
Is there a way to plot the vectorial sum of the green and purple arrow vector.
Thanks.

clc
clear
x = linspace(0,4*pi,100);
figure;
%only line
plot3(x,zeros(1,100),zeros(1,100),'k','LineWidth',2);
hold on
plot3(x,sin(x),zeros(1,100),'k');
plot3(x,zeros(1,100),sin(x),'k');
xlabel('X axes', 'FontSize',10, 'FontName','NewsGotT', 'fontWeight','bold');
ylabel('Y axes', 'FontSize',10, 'FontName','NewsGotT', 'fontWeight','bold');
zlabel('Z axes', 'FontSize',10,'FontName','NewsGotT', 'fontWeight','bold');
x_quiver = 0:pi/4:4*pi;
q1 = quiver3(x_quiver,zeros(1,17),zeros(1,17),zeros(1,17),sin(x_quiver),zeros(1,17),0);
q2 = quiver3(x_quiver,zeros(1,17),zeros(1,17),zeros(1,17),zeros(1,17),sin(x_quiver),0);
hold off;
0 commentaires
Réponse acceptée
Pavl M.
le 8 Nov 2024
clc
clear
x = linspace(0,4*pi,100);
figure;
%only line
plot3(x,zeros(1,100),zeros(1,100),'k','LineWidth',2);
hold on
plot3(x,sin(x),zeros(1,100),'k');
plot3(x,zeros(1,100),sin(x),'k');
plot3(x,sin(x),sin(x),'k');
xlabel('X axes', 'FontSize',10, 'FontName','NewsGotT', 'fontWeight','bold');
ylabel('Y axes', 'FontSize',10, 'FontName','NewsGotT', 'fontWeight','bold');
zlabel('Z axes', 'FontSize',10,'FontName','NewsGotT', 'fontWeight','bold');
x_quiver = 0:pi/4:4*pi;
q1 = quiver3(x_quiver,zeros(1,17),zeros(1,17),zeros(1,17),sin(x_quiver),zeros(1,17),0);
q2 = quiver3(x_quiver,zeros(1,17),zeros(1,17),zeros(1,17),zeros(1,17),sin(x_quiver),0);
q3 = quiver3(x_quiver,zeros(1,17),zeros(1,17),zeros(1,17),sin(x_quiver),sin(x_quiver),0);
hold off;
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Surface and Mesh Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!