To plot a graph with two different y values related to the same x values in Matlab, you can use the yyaxis
command. Here is an example code:
main.m256 chars14 lines
In this code, yyaxis left
sets the left y-axis as active, and yyaxis right
sets the right y-axis as active. The plot
function is then used to plot the data on the respective y-axes. Note that we also include xlabel
and ylabel
commands to label the axes.
gistlibby LogSnag