Matlab 在plotyy中绘制相同的图形

Matlab 在plotyy中绘制相同的图形,matlab,plot,matlab-figure,figure,Matlab,Plot,Matlab Figure,Figure,早上好, 我试图用Matlab中相同的代码绘制这个图。然而,它根本不起作用。我只是不能得到相同的数字,而是使用plotyy。 我之所以需要plotyy,是为了让读者通过绘制相同的函数,但乘以常数,来理解左手数字的意义。右手边称为增益,因此读者至少知道特定功率的增益是多少。 代码如下: [![r=1:0.001:3; R=50; kappa=0.5; L1=1000; c1=R/(8*kappa*L1); Frmin=(r+r.^-1).*(r-1)./(r+1); Frmax=(r+r.^-1)

早上好, 我试图用Matlab中相同的代码绘制这个图。然而,它根本不起作用。我只是不能得到相同的数字,而是使用plotyy。 我之所以需要plotyy,是为了让读者通过绘制相同的函数,但乘以常数,来理解左手数字的意义。右手边称为增益,因此读者至少知道特定功率的增益是多少。 代码如下:

[![r=1:0.001:3;
R=50;
kappa=0.5;
L1=1000;
c1=R/(8*kappa*L1);
Frmin=(r+r.^-1).*(r-1)./(r+1);
Frmax=(r+r.^-1).*(atan(r)-atan(1./r));
P1min=c1.*Frmin;% the 1st function for the left hand side of plotyy
P1max=c1.*Frmax;% the 2nd function for the left hand side of plotyy
YYmin=P1min*20; % the 1st function for the right hand side of plotyy
YYmasx=P1max*20;% the 2nd function for the right hand side of plotyy
figure;
ha1 = area(\[1 3\], \[0 M.*c1\]);
hold on
plot(r,P1min,'r','Linewidth',8)
fill(\[r fliplr(r)\],\[P1min,fliplr(P1max)\],'y')
plot(r,P1max,'k','Linewidth',5);
hold off
legend('\Delta >0','\Delta=0', '\Delta<0','Pmax')
%,'900','800','700','600','500')
xlabel('r')
ylabel('P_p (W)')
title('P_p vs r for L= 1000 m')][1]][1]
[![r=1:0.001:3;
R=50;
kappa=0.5;
L1=1000;
c1=R/(8*卡帕*L1);
Frmin=(r+r.^-1)。*(r-1)。/(r+1);
Frmax=(r+r.^-1)。*(atan(r)-atan(1./r));
P1min=c1.*Frmin;%plotyy左侧的第一个函数
P1max=c1.*Frmax;%plotyy左侧的第二个函数
YYmin=P1min*20;%plotyy右侧的第一个函数
YYmasx=P1max*20;%plotyy右侧的第二个函数
图形
ha1=面积(\[13\],\[0 M.*c1\]);
等等
绘图(r,P1min,'r','Linewidth',8)
填充(\[r fliplr(r)\],\[P1min,fliplr(P1max)\],'y')
绘图(r,P1max,'k','Linewidth',5);
拖延

图例('\Delta>0'、'\Delta=0'、'\Delta这就是您要找的吗?

编辑您的代码(此操作正常):

你的因素和阴谋

myFactor1 = 5;
[ax,~,~] = plotyy(r,P1min,r,myFactor1*P1min);
将轴颜色设置为黑色并控制字体

set(ax,{'ycolor'},{'k';'k'},{'FontSize'},{8;15})
代码的其余部分,已编辑并正在运行

legend('\Delta >0','\Delta=0', '\Delta<0','Pmax')
xlabel('r')
ylabel('P_p (W)')
title('P_p vs r for L= 1000 m')

图例('\Delta>0','\Delta=0','\Delta是第一行,应该是
r=1:0.001:3;
?和
ha1=区域(\[13\],\[0 M.*c1\]))
,你的意思是什么?M是什么?让你的示例工作起来,我也许可以帮助你。感谢你的努力和帮助。我想用黑色显示两个y轴并控制它们的字体。我尝试添加函数gca,我能够更改颜色和字体,但是由于某种原因,我丢失了绘图本身。对此有何评论答案已添加到答案中;)如果答案解决了您最初的问题,如果您愿意接受,我将不胜感激。谢谢老兄!
legend('\Delta >0','\Delta=0', '\Delta<0','Pmax')
xlabel('r')
ylabel('P_p (W)')
title('P_p vs r for L= 1000 m')