How can I put arrow heads on the plotted lines?

19 ビュー (過去 30 日間)
Wiqas Ahmad
Wiqas Ahmad 2021 年 4 月 26 日
回答済み: Walter Roberson 2021 年 4 月 26 日
I want to put arrow heads on the blue lines u,v and w so that they represent as vectors.
clear all;
close all;
clc;
%%
x=linspace(0,2,50);
y=linspace(0,2,50);
z=linspace(0,2,50);
[X, Y, Z]=meshgrid(x,y,z);
Ex=sin(-2*pi*Z/2+pi);
Ey=0*X;
Ez=0*X;
[Bx, By, Bz]=curl(X, Y, Z, Ex, Ey, Ez);
for k=1:50
E(k)=mean(mean(Ex(:,:,k),1),2);
B(k)=mean(mean(Ex(:,:,k),1),2);
end
%%
hold on
plot3(0,0,0,'r','Linewidth',2);
quiver3(0*x(1:2:50),0*y(1:2:50),0*z(1:2:50),0*x(1:2:50),0*y(1:2:50),0*z(1:2:50),0,'b', 'Linewidth', 2);
hold on
plot3(x,0*y,0*z,'b','LineWidth',2);%%% plotting inner axis lines
plot3(0*x,-y,0*z,'b','LineWidth',2);
plot3(0*x,0*y,z,'b','LineWidth',2);
text(1.2,0,0,'v','FontSize', 14);%%% showing x,y,z at the axis end
text(0,-1.2,0,'w','FontSize', 14);
text(0,0,1.2,'u','FontSize', 14);
grid on
set(gca,'FontSize', 14, 'Linewidth',1);%%% controle size of the figure
xlabel('\bf x','position',[0 -1.45 -1])
ylabel('\bf y','position',[-1.45 0 -1])
zlabel('\bf z')
xlim([-1 1]);
ylim([-1 1]);
zlim([-1 1]);
Ax = gca;
Ax.XAxis.Visible = 'on';%%% turn OFF or ON the outer-axis of the box
Ax.YAxis.Visible = 'on';
Ax.ZAxis.Visible = 'on';
box off
view(3)
camup([-1 0 1]) %%%camera view can be change by changing values.
camroll(90)%%%can also rotate the camera

回答 (1 件)

Walter Roberson
Walter Roberson 2021 年 4 月 26 日
https://stackoverflow.com/questions/42623867/putting-arrows-in-a-matlab-figure-showing-orientation-of-axes

カテゴリ

Help Center および File ExchangeLighting, Transparency, and Shading についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by