How do I only highlight the decreasing portion of the green in the plot with the find function?

1 Ansicht (letzte 30 Tage)
The green in the graph that is highlighted on the curve, i want it so it would only highlight the peak and the decreasing slope areas? How would I go about that and incorporate it if this is part of my code: section = find( ft > (8));
  3 Kommentare
Rik
Rik am 10 Sep. 2021
I recovered the removed content from the Google cache (something which anyone can do). Editing away your question is very rude. Someone spent time reading your question, understanding your issue, figuring out the solution, and writing an answer. Now you repay that kindness by ensuring that the next person with a similar question can't benefit from this answer.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Star Strider
Star Strider am 9 Sep. 2021
The vector in the plot image (or the code to create it) are not available, so I substituted my own.
This should get you started —
x = linspace(3, 12); % Create Data
y = sinc(x-7.5); % Create Data
[pks,locp] = findpeaks(y); % Peaks & Location Indices
[vys,locv] = findpeaks(-y); % Valleys & Location Indices
figure
plot(x, y) % Plot Original Vector
hold on
for k = 1:numel(locp)
idxrng = locp(k) : min(locv(locv>locp(k))); % Define Range Of Indices
idx(idxrng) = y(idxrng)>= 0.6; % Define Portion Of Curve
plot(x(idx), y(idx), '-g', 'LineWidth',5) % Plot Withg Highlights
end
hold off
Make appropriate changes to work with other vectors.
.

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by