How do I juxtapose the two plots so that the circles indicating the peak amplitude is in contrast with the plot?

조회 수: 3 (최근 30일)
How do I juxtapose the two plots so that the circles indicating the peak amplitude is in contrast with the plot?
figure (5), plot(t,Ca,'Color','r'), ylabel('Ca (mM)'), xlabel('Time (ms)')
[pks,locs] = findpeaks(Ca)
hold on;
plot(locs,pks,'o');
  댓글 수: 1
Turlough Hughes
Turlough Hughes 2022년 2월 1일
Please use a smaller image of the figure to make your question more legible. If you click "edit" on your question you can easily adjust the size there.

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

채택된 답변

Star Strider
Star Strider 2022년 2월 1일
Try this —
plot(t(locs),pks,'o');
The reason is that with this findpeaks call:
[pks,locs] = findpeaks(Ca)
The ‘locs’ output returns the indices of the peaks. There is nothing wrong with that, and I prefer it, however it just needs to be borne in mind to provide the correct references to the various variables.
.

추가 답변 (1개)

Turlough Hughes
Turlough Hughes 2022년 2월 1일
You need to include t in your call to findpeaks. For example:
t = linspace(0,1,1000);
Ca = t./exp(t).*(1-sin(2*pi*t*20));
plot(t,Ca)
[pks,locs] = findpeaks(Ca,t);
hold on;
plot(locs,pks,'o');

카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by