Need help with 3D animation matlab
sxgs
Pennsylvania
Hi, I am very inexperienced with matlab and I have be fiddling around with this code for over a day now and seems to be very close but just could not get it right. Any help will be much appreciated thank you!!!
clear all
clc
imp=4650;
c=3900;
f = .002;
%input( 'imput frequency f(in GHz):' );
w = ((2*pi)/f);
k = (w/c);
a = 0.19*f + 0.88*(f^(1.9))
s = .2;
%input( 'enter input signal in Watts: ');
A = 10^-4;
%input ( 'enter SAW working area in m^2: ');
Z = c*imp
t=0;
Pzero = sqrt((s*Z)/A)
x=0:1:100;
[X,Y]=meshgrid(x,x);
for j= 1:40
Px = Pzero.*exp(-a.*X./2).*exp(i*(k.*X-2*pi*f*t));
Py = Pzero.*exp(-a.*Y./2).*exp(i*(k.*Y-2*pi*f*t));
surfc(X,Y,real(Px) + real(Py));
shading interp
frames(:, j) = getframe;
end
title('Movie being played back...')
movie(frames, 1, 2)
clear all
clc
imp=4650;
c=3900;
f = .002;
%input( 'imput frequency f(in GHz):' );
w = ((2*pi)/f);
k = (w/c);
a = 0.19*f + 0.88*(f^(1.9))
s = .2;
%input( 'enter input signal in Watts: ');
A = 10^-4;
%input ( 'enter SAW working area in m^2: ');
Z = c*imp
t=0;
Pzero = sqrt((s*Z)/A)
x=0:1:100;
[X,Y]=meshgrid(x,x);
for j= 1:40
Px = Pzero.*exp(-a.*X./2).*exp(i*(k.*X-2*pi*f*t));
Py = Pzero.*exp(-a.*Y./2).*exp(i*(k.*Y-2*pi*f*t));
surfc(X,Y,real(Px) + real(Py));
shading interp
frames(:, j) = getframe;
end
title('Movie being played back...')
movie(frames, 1, 2)
0