Clear Filters
Clear Filters

Propogating a Wave with a change in media

2 views (last 30 days)
lpott005
lpott005 on 29 Sep 2020
Hello!
I am trying to create an animation of a normally incident gaussian pulse, and its reflection and transmission when it changes media. So far all I have done is created the pulse itself as an initial condition. I am struggling to find an answer for how to code the reflection and transmission of the pulse as it interacts with a change in media.
This is the code that I have so far:
%Wave Animation
%Original Wave: yinc=A cos(k1x−ωt)
%Reflected Wave yref=B cos(k1x+ωt)
%Transmitted Wave: ytrans=C cos(k2x−ωt)
clear all
close all
clc
%System Parameters
Eps0 = 8.854E-12;
Eps1 = 1E-10;
E0=1;
x0=0;
Sigma=0.5; %Needs value
%Frame
InitialX = linspace(-2,2, 100);
TravelX=linspace(2, 10, 200);
FullX=[InitialX, TravelX];
% X=linspace(0, 5, 500);
T=linspace(0, 10, 1000);
nInit=Eps0;
for x_Initial=1:length(InitialX)
EyI(x_Initial)=E0*exp(-(InitialX(x_Initial)-x0)^2/Sigma^2);
BzI(x_Initial)=nInit*EyI(x_Initial);
end
EyFiller=zeros(1,200);
EyInitial=[EyI,EyFiller];
%Change media
if InitialX > 1
n=(Eps0);
else
n=sqrt(Eps1);
end
% ETest=[InitialX; EyI]
% plot(InitialX, EyI)
plot(FullX, EyInitial)
xlim([0,10])

Answers (0)

Categories

Find more on Programming in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!