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');
效果圖: