Apr 24, 2012 #1 E eng_boody Member level 3 Joined Nov 27, 2011 Messages 57 Helped 1 Reputation 2 Reaction score 1 Trophy points 1,288 Activity points 1,754 hi how to plot the EM wave in matlab ....also how to plot phasor phath vs time thanks
Apr 24, 2012 #2 F ferdem Full Member level 2 Joined Oct 18, 2008 Messages 135 Helped 31 Reputation 62 Reaction score 35 Trophy points 1,308 Location Türkiye Activity points 2,866 Here is planewave: Code: [x,y]=meshgrid(5:0.05:15,-5:0.05:5); lambda=1; k=2*pi/lambda; f=3e8/lambda; w=2*pi*f; t=linspace(0,60e-9,200); %z=exp(i*k*abs(x+i*y)); z=exp(i*k*x); for n=1:length(t) surf(x,y,real(z*exp(-i*w*t(n)))); %view(ceil(90*n*1/length(t)),ceil(90*n*2/length(t))); view(3) zlim([-1.5 1.5]) xlim([min(min(x)) max(max(x))]) ylim([min(min(y)) max(max(y))]) shading interp getframe(); end
Here is planewave: Code: [x,y]=meshgrid(5:0.05:15,-5:0.05:5); lambda=1; k=2*pi/lambda; f=3e8/lambda; w=2*pi*f; t=linspace(0,60e-9,200); %z=exp(i*k*abs(x+i*y)); z=exp(i*k*x); for n=1:length(t) surf(x,y,real(z*exp(-i*w*t(n)))); %view(ceil(90*n*1/length(t)),ceil(90*n*2/length(t))); view(3) zlim([-1.5 1.5]) xlim([min(min(x)) max(max(x))]) ylim([min(min(y)) max(max(y))]) shading interp getframe(); end