1
如何用matlab画4条双y轴的图,2条以左边y轴为准,2条以右边y轴为准
:https://zhidao.baidu.com/question/511297752.html
2.
如何用matlab画这种2个y轴的图?请大家帮忙写个能实现的程序。
3plotyy怎么设置不同图形色的颜色?坐标轴怎么设置?.https://www.ilovematlab.cn/thread-485190-1-1.html
4附上自己的代码:
close all; clear all; clc %% parameters set c=3.0*10^8; n = 2.8696;%neff R =4694.4;%5000nm;5um r = 0.95; t = sqrt(1-r^2); tao = 0.95; lambda = 1597;%nm %% cycle calculation kk = 0 fai=[]; S21=[]; T=[]; ang=[]; for lambda = 1550:0.05:1650 kk = kk+1; % f=c/lambda; % n=c/(f*lambda); fai(kk) = 2*pi*R*2*pi*n/lambda; S21(kk) = exp(i*(pi+fai(kk)))*(tao-r*exp(-i*fai(kk)))/(1-r*tao*exp(i*fai(kk))); T(kk) = abs(S21(kk))^2; ang(kk) = angle(S21(kk)); end %% show figure figure(1) lambda=[1550:0.05:1650]; hold on; [ax,h1,h2]=plotyy(lambda,T,lambda,ang,'plot'); set(h1,'color','r'); set(h2,'color','k'); % set(h2,'color','k','marker','o','MarkerSize',2); set(get(ax(1),'Ylabel'),'string','透射率T'); set(get(ax(2),'Ylabel'),'string','相位'); xlabel('波长λ(nm)'); hold off; title('微环谐振光谱图'); legend('透射率','Phase');
效果图: