How can i plot a vertical line (x=constant) in a maximum of a curve ?

조회 수: 2 (최근 30일)
Mallouli Marwa
Mallouli Marwa 2017년 3월 22일
답변: Rik 2017년 3월 22일
Hi
How can i add three vertical line in the maximums of this curve.
The program and the curve are attached.

답변 (1개)

Rik
Rik 2017년 3월 22일
%First find the maximum values
maxes(1)=max(p100(:));maxes(2)=max(p1k(:));maxes(3)=max(p100k(:));maxes(4)=max(p10M(:));
maxes=maxes(:).*1e6;
maxes=repmat(maxes,1,2);
%Now find the x-extent
x_range=[min(freq(:)) max(freq(:))];
%plot the curves
semilogy(freq,p100*1e6,'b',freq,p1k*1e6,'m',freq,p100k*1e6,'c',freq,p10M*1e6,'--')
legend('100\Omega','1k\Omega','100k\Omega', '10M\Omega')
xlabel('Excitation frequency (Hz)')
ylabel('|Power FRF| [\muW/g^2]')
%plot the limit lines (you could also use a loop for this)
hold on
plot(maxes,x_range)

카테고리

Help CenterFile Exchange에서 Smoothing and Denoising에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by