MATLAB Answers

How to create animation of wave pattern h(x,y,t) = Acos(2*pi*t/T-2*pi*x/L) with T=4s , L=12m, -300<=x<=300, -300<=y<=300 , 0<=t<=20

4 views (last 30 days)
clc
clear all
A=1;
T=4;
L=12;
syms t
t=0:1:20;
x=-300:10:300;
H=A*cos(2*pi*t/(T)-2*pi*x/(L))
for k=1:length(t)
plot(t(k),H(k),'+')
axis([-0.5 20.5 -2 2])
pause(0.25)
end

  3 Comments

Aagam Jain
Aagam Jain on 20 Apr 2020
Wave Patterns In the open ocean under circumstances where the wind is blowing steadily in the direction of wave motion, successive wavefronts tend to be parallel. The height of the water at any point might be represented by the equation
h(x,y,t)= A cos (2pi*t/T - 2pi*x/L
where T is the period of the waves in seconds, L is the spacing between wave peaks, and t is current time. Assume that the wave period is 4 s and the spacing between wave peaks is 12 m. Create an animation of this wave pattern for a region of -300 m < x < 300 m and -300 m <y < 300 m over a time of 0 < t < 20 s using erase and redraw.
This is the full actual question and i too dint find y in the equation, so i tried solving it for x and t so if anyone could do that ...?
And this ques is from MATLAB for Engineers 5th edition (ques no. 13.10) and if there is any mistake in the ques above plz do comment so that i can solve this ques

Sign in to comment.

Accepted Answer

BALAJI KARTHEEK
BALAJI KARTHEEK on 20 Apr 2020
clc
clear all
A=1;
T=4;
L=12;
syms t
t=0:(((300-(-300))/10)^-1)*20:20;
x=-300:10:300;
H=A*cos(2*pi*t/(T)-2*pi*x/(L));
for k=1:length(t)
plot(t(k),H(k),'*')
axis([-0.5 20.5 -2 2])
pause(0.25)
end
To evaluate H t and x array length must be same, and rest all wil be same... u will get the graph as a dynamic one, varying with respect to time thats it,,

Products


Release

R2015b

Community Treasure Hunt

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

Start Hunting!