MATLAB: How to normalize two waves on a single plot

cosMATLABnormalizeplotsin

Basically i want to normalize and display the maximum and minimum values between y and y2 for the following code so that they both display on the same plot
t=0:0.001:0.05;
y= 11.18*cos(60*pi*t+26.565);
y2= -60*pi*11.18*sin(60*pi*t+26.565);
title('Phasor Waveforms')
f1=max(y);
f2=max(y2);
hold on
plot(t,y)
plot(t,y2)
hold off

Best Answer

Try this:
t=0:0.001:0.05;
y= 11.18*cos(60*pi*t+26.565);
y2= -60*pi*11.18*sin(60*pi*t+26.565);
title('Phasor Waveforms')
f1=max(y);
f2=max(y2);
figure
yyaxis left
plot(t,y)
yyaxis right
plot(t,y2)
See the documentation for yyaxis (R2016a and later releases, earlier releases plotyy, and different code) for details.