ploting vectorial expression in 3D question

29 ビュー (過去 30 日間)
fima v
fima v 2024 年 10 月 24 日 17:51
回答済み: Divyajyoti Nayak 2024 年 10 月 25 日 6:21
Hello,I have the formula and photo shown below.
Is there a way to do a similar plot in matlab (if vectorial arrows is possible then its great)

回答 (1 件)

Divyajyoti Nayak
Divyajyoti Nayak 2024 年 10 月 25 日 6:21
Hi Fima,
The electromagnetic wave can be plotted using the “plot3” function and the arrow heads can be plotted using the “quiver3” function. Here are the documentation links to help you out along with some sample code to plot a similar plot:
clc
clear
x = linspace(0,4*pi,100);
figure;
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');
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;

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by