I am trying to create a sinusoidal model to simulate the sea as a fixed surface, but I'm not sure how to adapt a simple sinusoidal model so that the wave height and frequency varies within a range (more like the sea). I would change the range for varying sea states, but just need to see how to create a varying amplitude and frequency within a secified range.

댓글 수: 5

darova
darova 2020년 4월 13일
Can you show something? Picture?
t=0:0.1:20
X0= input('Wave amplitude ')
w=input('Wave Frequency ')
y=X0sin(wt) %simple sinusoidal wave with no variation
This is just a standard wave with no variation, but I want a random array of amplitudes between set values.
darova
darova 2020년 4월 13일
Can you make a sketch? I don't understand
Reuben Salisbury
Reuben Salisbury 2020년 4월 13일
I am trying to make the value of X0 vary so that the maximum amplitude is not always constant
try this madness
x = 0:0.01:10;
y = sin(20*x).*sin(x);
plot(x,y)

댓글을 달려면 로그인하십시오.

 채택된 답변

Ameer Hamza
Ameer Hamza 2020년 4월 13일
편집: Ameer Hamza 2020년 4월 13일

0 개 추천

Try something like this
t = linspace(-10,10,100);
[X,Y] = meshgrid(t);
f = (sin(X+Y)/2+0.5)*0.3+0.3; % frequency change between 0.3 to 0.6
A = (cos(X.*Y/3.5)/2+0.5)*0.3 + 0.7; % amplitude change between 0.7 to 1.0
Z = A.*sin(f.*X).*sin(f.*Y);
surf(X,Y,Z)
It have both variable frequency and amplitude between a specified range.

댓글 수: 7

Reuben Salisbury
Reuben Salisbury 2020년 4월 14일
is there a way to make it so that the amplitude and frequency are randomly varying in 2 dimensions only? or otherwise a way that i can simulate a boat travelling over the surface you have shown?
Ameer Hamza
Ameer Hamza 2020년 4월 14일
By two dimensions, do you want to have one just independent and one dependent variable?
Reuben Salisbury
Reuben Salisbury 2020년 4월 14일
yes exactly, just a sinusoidal function in two dimensions with a varying amplitude and frequency
Ameer Hamza
Ameer Hamza 2020년 4월 14일
편집: Ameer Hamza 2020년 4월 14일
try this
Ts = 0.01;
x = -100:Ts:100;
fd = (sin(x)/2+0.5)*0.4+0; % frequency change between 0 to 0.4
fx = cumsum(fd)*Ts;
A = (cos(x/3.5)/2+0.5)*0.7 + 0.3; % amplitude change between 0.3 to 1.0
z = A.*sin(fx);
plot(x,z)
Reuben Salisbury
Reuben Salisbury 2020년 4월 14일
편집: Reuben Salisbury 2020년 4월 14일
That's Great, thank you so much for all of your help.
What figures need to be changed to vary the range of frequencies/ampltudes?
In this equation
fd = (sin(x)/2+0.5)*0.4+0; % frequency change between 0 to 0.4
0 at the end is the lower range of the frequency and 0.4 is the change in frequency. So
fd = (sin(x)/2+0.5)*1.0+0.5;
will have frequency in range [0.5, 1.5].
Similar parameters are defined for amplitude.
Reuben Salisbury
Reuben Salisbury 2020년 4월 14일
Great, thanks again.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Model Order Reduction에 대해 자세히 알아보기

질문:

2020년 4월 13일

댓글:

2020년 4월 14일

Community Treasure Hunt

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

Start Hunting!

Translated by