plotting vector in matlab
23 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
採用された回答
Pavl M.
2024 年 11 月 8 日 16:08
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 件のコメント
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!