matlab双坐标轴设定
clc; clear all; close all;
![](https://images0.cnblogs.com/blog2015/680703/201507/112314122523656.jpg)
x1 = 0:.1:40; y1 = 4 * cos(x1)./(x1 + 2); x2 = 1:.2:20; y2 = x2.^2 ./ x2.^3; h11 = line(x1,y1,'Color','r'); ax1 = gca; aa = get(ax1,'position'); aa(1:2) = aa(1:2) + .1; aa(3:end) = aa(3:end) - .2; % aa(1:2) = aa(1:2)+1 set(ax1,'XColor','r','YColor','r'); ax2 = axes('position',aa,... 'XAxisLocation','bottom',... 'YAxisLocation','left',... 'Color','none',... 'XColor','k','YColor','k'); h12 = line(x2,y2,'Color','k','Parent',ax2);