Varying a sinusoidal input

4 views (last 30 days)
Reuben Salisbury
Reuben Salisbury on 13 Apr 2020
Commented: Reuben Salisbury on 14 Apr 2020
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 Comments
darova
darova on 13 Apr 2020
try this madness
x = 0:0.01:10;
y = sin(20*x).*sin(x);
plot(x,y)

Sign in to comment.

Accepted Answer

Ameer Hamza
Ameer Hamza on 13 Apr 2020
Edited: Ameer Hamza on 13 Apr 2020
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 Comments
Reuben Salisbury
Reuben Salisbury on 14 Apr 2020
Great, thanks again.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!