Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

how to plot single curve with 2 yaxis align?

조회 수: 1 (최근 30일)
LEONG SING YEW
LEONG SING YEW 2020년 3월 22일
마감: MATLAB Answer Bot 2021년 8월 20일
Hi everyone,
i am trying to plot only a single curve, and that every points of the curve is align to the data from Y1 and Y2, for example: (0.015, 0.05, -130) is not correctly plotted as shown in the image below (the phase difference is wrong.
i'm not sure if i am using the correct commands, appreaciate any help
X = [0.015 0.060 0.100 0.140]; %Equivalence Ratio
Y1 = [0.05 0.128 0.215 0.313] %HRR magnitude
Y2 = [-130 -118 -111 -105]; %Phase Difference
hold on
[ax,h1,h2] = plotyy(X,Y1,X,Y2,'plot');
set(h2, 'Visible','off') %turn off second plot (not needed)
set(h1,'LineStyle','--','Marker','s','Color','b',...
'DisplayName',"q'/q_o")

답변 (1개)

Cris LaPierre
Cris LaPierre 2020년 3월 23일
편집: Cris LaPierre 2020년 3월 23일
Your second plot is not appearing.
Starting in r2016a, the recommended way to plot with 2 y-axes is to use yyaxis.
= [0.015 0.060 0.100 0.140]; %Equivalence Ratio
Y1 = [0.05 0.128 0.215 0.313]; %HRR magnitude
Y2 = [-130 -118 -111 -105]; %Phase Difference
yyaxis left
plot(X,Y1,'--bs',"DisplayName","q'/q_o")
yyaxis right
plot(X,Y2);
legend

태그

Community Treasure Hunt

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

Start Hunting!

Translated by