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 (최근 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

제품


릴리스

R2015b

Community Treasure Hunt

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

Start Hunting!

Translated by