How to model a transverse wave in Matlab (Wave Equation)

18 views (last 30 days)
if true
% USE POTENTIAL SOLUTION TO SCALAR WAVE EQUATION TO
% PLOT S WAVE
clear
% TIME DOMAIN
t = 0:1:500;
% WAVE VECTOR
k1 = 0.4;
k2 = 0.2;
k3 = 0.3;
% COORDINATES OF RAY (DETERMINED BY WAVE VECTOR)
x = 0:2.5:50;
y = k2/k1*x;
z = k3/k1*x;
% DIV(K,X)
KX = sum([k1*x; k2*y; k3*z]); % k.x
% OTHER WAVE PARAMETERS
A = 3; % AMPLITUDE
w = 0.1; % ANGULAR FREQUENCY
% LOOP OVER TIME STEPS
for n = 1:numel(t)
% DISPLACEMENTS (CURL OF SCALAR POTENTIAL):
ux = k1*A*(sin(w*t(n) - KX));
uy = k2*A*(sin(w*t(n) - KX));
uz = k3*A*(sin(w*t(n) - KX));
% PLOT WAVE FOR CURRENT TIME STEP
hold off
plot3(x,y,z,'r-');
hold on
plot3(x+ux,y+uy,z+uz,'ko','markersize',4,...
'markerfacecolor','k');
axis equal
axis([-10 55 -10 30 -5 40])
xlabel('x'), ylabel('y'), zlabel('z')
title(num2str(t(n)))
grid on
drawnow
end end
The current code models a longitudinal wave; a wave that oscillates along the direction of propagation.
However, I am trying to model a transverse wave, where the wave oscillates perpendicular to the direction of propagation.
u(z,t) = ∇φ(z,t) = (0,0,−ik)Aexp[i(ωt − kz)] is what dictates the longitudinal wave (z is direction of propagation)
here A (which is amplitude, defined by A = 3 in the code, is just a variable)
u(z,t) = ∇ × Ψ(z,t) = (ikAy ,−ikAx ,0)exp[i(ωt − kz)] is what dictates the transverse wave. Here, A is a vector quantity, and I am not sure how to define my previously used variable A, and split it into Ax and Ay.
Thanks for any help

Answers (0)

Categories

Find more on Airfoil tools in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!