Plotting JONSWAP spectrum with unknown frequency and "guessed" frequency

48 views (last 30 days)
Hi,
Working with the JONSWAP spectrum.
From the attached formula:
I need to plot this formula against a frequency axis, and as the frequency f is unknown in the JONSWAP formula (fp is known), MATLAB will not accept the formula with the undefined parameter.
Any suggestions?
Regards
  1 Comment
Jose M Medina
Jose M Medina on 8 Nov 2018
Probably I didn't understand properly yr question, but I think it's easy:
for f =fmin:deltaf:fmax
compute S for each f and store in a matrix
end
plot(f,S)
Or not? :-o

Sign in to comment.

Answers (1)

Dallan Friel
Dallan Friel on 26 Nov 2018
Edited: Dallan Friel on 26 Nov 2018
Hi,
You are meant to send a vector of frequencies to the function, i.e. a range of frequency values between say 0 and 1.5 in steps of 0.1, So it will carry out the calulation for each singular f value in the vector. (0, 0.1, 0.2, 0.3, 0.4....1.5) and output the energy density of each, you then plot the output vector against the f value vector.
Simpols
Regards,
Dallan

Categories

Find more on MATLAB in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!