How to plot this?

2 views (last 30 days)
Alecia Gill
Alecia Gill on 3 Dec 2019
Answered: Star Strider on 3 Dec 2019
%Invert the data to use findpeaks to find the valleys
negdepthFeet = -depthFeet;
dur = duration(15,0,0);
% Use findpeaks
[lowerLowWater,lowerLowUTC] = findpeaks(negdepthFeet,
tideTime,'MinPeakProminence',10/12,'MinPeakDistance',dur);
lowerLowWater = -lowerLowWater;
MLLWmud = mean(lowerLowWater);
MLLW = 0;
% Tide level in feet relative to MLLW
feetMLLW = (depthFeet-MLLWmud);

Answers (1)

Star Strider
Star Strider on 3 Dec 2019
I am not certain what you want to plot, since you did not specify that.
Try this:
tideTime = linspace(0, 4*pi); % Create Data
depthFeet = cos(5*tideTime).*sin(tideTime); % Create Data
negdepthFeet = -depthFeet;
[lowerLowWater,lowerLowUTCidx] = findpeaks(negdepthFeet);
lowerLowWater = -lowerLowWater;
MLLWmud = mean(lowerLowWater);
MLLW = 0;
figure
plot(tideTime, depthFeet)
hold on
plot(tideTime(lowerLowUTCidx), depthFeet(lowerLowUTCidx), 'vr')
hold off
grid
Experiment to get different results.

Categories

Find more on Polar Plots in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!