필터 지우기
필터 지우기

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

조회 수: 2 (최근 30일)
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
Rik
Rik 2021년 9월 10일
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.

댓글을 달려면 로그인하십시오.

답변 (1개)

Star Strider
Star Strider 2021년 9월 9일
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.
.

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by