f=1.3, t=0.01, T=1./f, phi=pi./4, a=0.05, range=[0:t:T], w=2.*pi./T, y = a.*(cos((w​.*range)+p​hi)),

1 view (last 30 days)
Write a user defined function findampl which inputs are a time vector, a wave elevation vector and the frequency of the wave and returns the amplitude of the wave (ampl = findampl(t, eta, f) ). The function should find the maximums and the minimums of the wave elevation over as many wave periods possible in the vector time. The function should not look for a maximum or a minimum if the remainder of the time is lesser than a wave period. The function should plot the wave elevation and the maximums and minimums found. The function should return the average calculated value of the wave amplitude. Test your function with a wave which has the same properties given in question 5 over 4.5 wave periods.

Answers (0)

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!