Matlab hw 3
rite code that performs the following tasks listed below. A hardcopy of the code and results, and an electronic copy of the code will be collected. Code will be executed by the instructor for testing; no errors or warnings should be present and requested output should be presented (prompt, graphical etc.). Remember to comment your code; at the top of your code write a block comment that includes your name, class (OCE 3522), lab number, program name, and date. When turning in your code on Canvas be sure to compress all your m-files into a zip file/folder (Canvas cannot upload m-files) and replace and title your folder oce3522_mlab4_lastname.zip (all in lower case, underscore instead of spaces).
1. Create a code that loads the waveheight.txt file. The first column of this data is time in seconds and the second column is water depth in feet. Detrend the wave depths in order to find wave heights. Use the findpeaks function to identify all the peaks within the data and then display to the user the first peak and last peak and corresponding locations (use 2 significant figures after the decimal place). Call your code wave_lastname.m.
2. Create a function that solves the following equation:
The tolerance should be to 0.001. Display the final answer and the number of iterations it took to complete this process. Call your function iteration_lastname.m.
3. Create a new code to implement your function, iteration_lastname. Create a vector ranging from 1 to 5. Use this vector as the input for your iteration function. Create a new matrix, b, the same size as a. Declare x equal to 2. Then, create a for loop that sets b equal to x+a, with x increasing by 2 for each element. (i.e. b(1)=2+a(1), b(2)=4+a(2), b(3)=6+a(3), etc.) Display b after your for loop is complete. Call your code iteration2_lastname.m.
4. Create a code that loads the Depth.csv file. This data was taken at a sampling rate of 7 Hz (or 7 samples per second), each row represents 1 s of data collection. Call your code water_lastname.m
a. Manipulate this into a column vector. Ensure that the data is in the correct order (hint: you must transpose the matrix first before altering the matrix using reshape).
b. Create a vector for time that correctly represents the sampling rate used for the data. (Hint: recall that 1 s of data contains 7 data points)
c. Detrend the data using the mean value, call these values depth_det. (if you need help with syntax try help detrend)
d. Plot your depth_det vector versus time vector and your original data versus time on the same graph. Make your graph detrended data line black and original depth line green. Include a legend and title and label your graph accordingly.
You can place an order similar to this with us. You are assured of an authentic custom paper delivered within the given deadline besides our 24/7 customer support all through.
Latest completed orders:
# | topic title | discipline | academic level | pages | delivered |
---|---|---|---|---|---|
6
|
Writer's choice
|
Business
|
University
|
2
|
1 hour 32 min
|
7
|
Wise Approach to
|
Philosophy
|
College
|
2
|
2 hours 19 min
|
8
|
1980's and 1990
|
History
|
College
|
3
|
2 hours 20 min
|
9
|
pick the best topic
|
Finance
|
School
|
2
|
2 hours 27 min
|
10
|
finance for leisure
|
Finance
|
University
|
12
|
2 hours 36 min
|