1
Data analysis and interpretation in Matlab
Practical 7 of ENVS117/ENVS602
Assessed as Assignment 2(15%)
___________________________________________________________________________
Last week, you learned what Matlab is, how to undertake some basic data entry and calculations, and some handy hints. Now, you are going to put these skills into practice so you will need to refer back to the notes from last week.
This practical is focused on waves, which we learned about in Oceans Lecture 2, so you will also need to revisit the lecture to understand and complete the assignment which is based on this practical.
Note that no extensions will be given for lost data, so you must back up your work.
Parts of this practical/ assignment
There are 3 parts, each of which will be assessed using the template provided on iLearn.
Part
Assessed by
1. Create and plot a sine wave
Your completed .mfile and figure
2. Sine wave plot interpretation and wave processes
Interpretation of wave plot and basic calculations
3. Plotting and interpreting real wave data
General summary of Sydney wave climate supported by figure
Assignment submission
This practical involves working through these notes and completing Assignment 2 which is due by Sunday 15th April at 5 pm. You must use the template provided on iLearn and submit your assignment online using the Turnitin link in iLearn.
Assessment criteria
The marking sheet and rubric for this assignment is located on iLearn in the Ocean module folder, under assessment. You will receive online feedback for this assignment.
You will be marked on all three parts of this assignment. You will be graded on your ability to:
• Follow instructions
• Write basic scripts and follow good coding practice e.g., comments, units
• Plot clear scientific figures
• Figure interpretation
• Undertake simple wave parameter calculations
• Describe key wave processes
• Describe the general wave climate of the Sydney region
2
Part 1: Create and plot a sine wave
1.1. Create a new folder for the assignment that you will work in.
1.2. Create a new script, and ensure you include an appropriate header comment saying what it does,
when it was made, and who made it.
* Note that you will be submitting your script for marking, so ensure you work only in your script,
and not in the Command Window.
1.3. Create a simple sine wave. Remember a sine wave/curve is a mathematical curve that
represents periodic oscillations of constant amplitude:
??(??) = ????????(2??????)
Where:
z=elevation
A = amplitude
t = time
f = frequency (Hz)
?? = pi
Use this formula in your script to create an idealized ocean wave, that:
• Ranges between 1s and 40 s at increments of 0.1 s
• Has frequency of 0.1 Hz
• Has wave height (H) of 1 m (note that A=1/2H))
Ensure that you include comments that say what each variable is with units.
1.4. Create a line plot of elevation with time.
1.5. Note that the default plot is missing some key elements, and isn’t very easy to read (especially
in the word document for your assignment). Export the figure into a word document to see what
it looks like. Change the following parameters to something more appropriate. To help you, type
‘help plot’ into the Command Window (or use Google); ‘help xlabel’; ‘help ylabel’ ‘help gca’;
‘help box’’ ‘help grid’
• Line width
• Add x and y labels
• Increase the font size of the x and y label (hint, use Google to figure this out)
• Increase the font size of the tick labels using set(gca,’fontsize’,24)
• Add a border (box)
• Add grid lines
• Make any other changes to make the plot look better.
Again, ensure you comment each line to say what it does.
1.6. Add your completed script and figure into the Assignment 2 template provided.
3
Part 2: Sine wave plot interpretation and wave processes
You must answer each of the following questions. Use the waves lecture notes to help you. Don’t forget
units.
Type your answers in the assignment answer template.
2.1. What is the period of this wave?
2.2. Based on the period, what type of ocean wave is this and why? [Hint: see lecture notes]
2.3. What is the wave height?
2.4. Label a wave crest and trough in your plot
2.5. What is the frequency of this wave?
* Frequency (f) is the inverse of period (T), f=1/T.
2.6. What is the estimated deep water wave length for your wave?
* Wave length (L) is the horizontal distance between identical parts of the wave, e.g.,
crest to crest. In deep water, wavelength can be estimated as: L=1.56T2.
2.7. What is the celerity for your wave?
* Wave celerity (C) is the speed that the wave form (shape) travels, where C=L/T.
2.8. What is the steepness of your wave?
* Wave steepness is the ratio of wave height to wave length.
2.9. At what depth will this wave start to feel the bottom?
* Deep water waves start to ‘feel the bottom’ when water depth is < 1/20*L.
2.10. Explain how waves transform as they travel from deep to shallow water? [Your answer should
be around 150-200 words]
4
Part 3: Plotting and interpreting real data
In this section, you have been provided with some real wave data from the Sydney Wave Buoy,
managed by Manly Hydraulics Laboratory (MHL). Information about this wave buoy can be found here:
http://new.mhl.nsw.gov.au/data/realtime/wave/Buoy-syddow. The data was downloaded here
https://portal.aodn.org.au/ and some preliminary formatting has been done to make it easier to load
for Matlab beginners. It covers the period from 1992 to 2010.
3.1. Save the wave data from iLearn.
3.2. Make a new script for this section where you will work from.
3.3. Load in the wave data into Matlab (*Refer back to the notes from last week, Practical 6)
3.4. Define what each of the 8 columns are in Matlab. In order, these are:
• Time (in Matlab format)
• Significant wave height (Hs) (m)
• Mean wave height (m)
• Root mean square wave height (m)
• Wave height of top 10% of waves (m)
• Maximum wave height (m)
• Mean wave period (s)
• Direction (degrees)
3.5. Create appropriate figures of wave height, period and direction with time on the x axis. You will
use these figures to support your answer to 3.6.
Some hints:
• You can overlay different variables on the same graph if you use the command hold on. This
could come in handy for the different measures of wave height! You would then also need
to add a legend using the command legend(‘variable1name’,’variable2name’,’etc’)
• You can plot multiple panels on the same figure using subplot
https://au.mathworks.com/help/matlab/creating_plots/create-graph-with-subplots.html
• Ensure you make your plots easy to read, and include all of the key elements of scientific
graphs (see last weeks notes).
• The time labels will by default be in Matlab time (days). You can convert to a readable
format by typing help datetick into the Command Window to get some hints.
• You can set the x and y limits using xlim and ylim e.g., to cut off the white space, or to plot
a certain period of time, such as 1 or a few years, if you choose to. You might do this if you
find looking at the entire dataset makes it hard to interpret. Remember that we are working
with time, so you will need to define the limits in time format e.g.,
xlim([datenum(yyyy,mm,dd) datenum(yyyy,mm,dd)]) to define the minimum and
maximum date.
3.6. Write around 100-150 words discussing the general wave climate of Sydney from 1992-2010.
Ensure you discuss wave height, period and direction. Include your figure(s) to support your answer.