Good afternoon, I have this code in Matlab plotting a 2 y axis curve also known as plotyy. I am interested in finding out why do I get two curves instead of one curve even though they are plotting the same curve?
r=1.1;
M=0.00063291;
D=-0.05;
kappa=0.5;
SQ=sqrt(-(0.5*D)^2 +M);
L=1001.6288;
z=0:0.001:L;
A=-kappa*SQ.*(z-L);
B=((sqrt(M)*r)+(D/2))/(SQ);
C=acot(B);
E=SQ*cot(A+C);
Pplus=E-(D/2);
Pminus=M./Pplus;
P0=Pplus+Pminus+D;
gamma=20;%\W\km
Pp=0.3159;
A=gamma.*Pp;%\W
y1=kappa.*1000.*(Pplus+Pminus);
y2 =y1./A;
figure
hax=axes;
[ax,p1,p2] = plotyy(z,y1,z,y2,'plot','plot');
set(ax,{'ycolor'},{'k';'k'})
set(ax,{'fontsize'},{18;18})
set(p1,'linewidth',3)% to change the first line
set(p2,'linewidth',3) % to change the second line
set(p1,'Color','b')% to change the first line
set(p2,'Color','b') % to change the second line
str = sprintf('D = %.6f ',D);
title(str);
ylabel(ax(1),'K_{SBS}(km)','fontsize',18,...
'Color','k') % label left y-axis
ylabel(ax(2),'K_{SBS}( \gamma P )','fontsize',18,...
'Color','k') % label right y-axis
xlabel(ax(2),'z(m)','fontsize',18,...
'Color','k')% label x-axis
set(ax(1),'XLim',[0 L])
set(ax(2),'XLim',[0 L])
% M=0.000576;
% D=-0.0468;
% L=1012.1779;
% Pp=0.5;
But if i choose the values found in the last 4 lines of the code, I do not get that. I just want to know why? Thank you