Skip to content

Instantly share code, notes, and snippets.

@thorade
Last active December 28, 2015 21:49
Show Gist options
  • Save thorade/7567373 to your computer and use it in GitHub Desktop.
Save thorade/7567373 to your computer and use it in GitHub Desktop.
create a Matlab plot with two y axes, then add a third and fourth line to it
x = -pi:.1:pi;
f1 = sin(x);
f2 = 100*cos(x);
f3 = cos(x/2);
f4 = 100*sin(x/2);
[axes,linehandle1,linehandle2] = plotyy(x, f1, x, f2);
linehandle3=line(x,f3,'Parent',axes(1),'LineWidth',2,'LineStyle','--');
linehandle4=line(x,f4,'Parent',axes(2),'LineWidth',2,'LineStyle','--');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment