How to plot this?

조회 수: 3 (최근 30일)
Alecia Gill
Alecia Gill 2019년 12월 3일
답변: Star Strider 2019년 12월 3일
%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);

답변 (1개)

Star Strider
Star Strider 2019년 12월 3일
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.

카테고리

Help CenterFile Exchange에서 Polar Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by