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

2 次查看(过去 30 天)
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 个评论
Aagam Jain
Aagam Jain 2020-4-20
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

请先登录,再进行评论。

采纳的回答

BALAJI KARTHEEK
BALAJI KARTHEEK 2020-4-20
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,,

更多回答(1 个)

darova
darova 2020-4-20
Here is the solution

类别

Help CenterFile Exchange 中查找有关 Programming 的更多信息

产品


版本

R2015b

Community Treasure Hunt

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

Start Hunting!

Translated by