plotting vector in matlab
24 views (last 30 days)
Show older comments
fima v
on 8 Nov 2024 at 15:15
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 Comments
Accepted Answer
Pavl M.
on 8 Nov 2024 at 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 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!