clear; %clear all variables from memory
close all; %close all windows
clc; %clear command window
disp('Wave Animation 1'); %display the title
%INPUTS
%wave parameters
frequency = 1e6;
velocity = 3e3;
%x parameters
x_end = 3e-02;%TO BE ENTERED%
x_step = 1.5e-04;%TO BE ENTERED%
%time parameters
t_step = 5e-08;%TO BE ENTERED%
t_points = 100;%TO BE ENTERED%
%PROGRAM
x = [0 : x_step : x_end]; %make a vector of x positions
t = [0 : t_step : t_step * t_points]; %make a vector of times
%calculate w and k from inputs
w = sym('pi*2e6');%TO BE ENTERED%
k = sym('(2/3)*pi*1000');%TO BE ENTERED%
figure(2);
for jj=1:length(t)
clf;
m=zeros(1,201);
[mx,mm]=meshgrid(x,m);
mmx=sqrt(mx.^2+mm.^2);
surf(mx,mm,cos(k*mmx-w*jj(t)));
pause(0.01);
end;
慕容3067478