显示我错误使用 + 矩阵维度必须一致,但我找不出来
clear all
clc
%======================================================================
% Fibre simulation parameters
lamdalD = 1.55e-6; %design wavelength
lamda1 = 0.999*lamdalD;
lamda2 = 1.001*lamdalD;
step = 500;
wal = (lamda1:(lamda2-lamda1)/step:lamda2);
%======================================================================
%For a grating of maximun reflectance R = 0.2
Rmax = 0.2; %required maximum reflectivity
rmax = sqrt(Rmax);
kacL = atanh(rmax);
c = 2.99793e8; %Speed of light
h = 25e-9;
t = 0:1e-3:1;
z = 0:1e-6:3000e-6;
v = 1;%Fringe visibilty
%======================================================================
%Implementation of the transfer matrix method for solution of
%coupled-mode equations
L = 3000e-6; %length of grating in micrometers
M = 100;
dz = L/M;
dzo = - L + 10.69e-3; %Distance between gratings
kac = kacL/L; %"AC" coupling coefficient
kdc = 2*kac/v; %"DC" coupling coefficient
neff = 1+v*cos(cos(t)+2*pi*z/dz); %core index of fibre
for r = 1:step+1
w = lamda(r);
F = [1 0; 0 1];
for s = 1:M
det = 2*pi*neff*(1/w - 1/lamdalD);
gdc = det + kdc;
p1 = sqrt(kac^2 - gdc^2);
p2 = gdc^2/kac^2;
f11 = cosh(p1*dz) - 1i*(gdc/p1)*sinh(p1*dz);
f12 = -1i*(kac/p1)*sinh(p1*dz);
f21 = 1i*(kac/p1)*sinh(p1*dz);
f22 = cosh(p1*dz) + 1i*(gdc/p1)*sinh(p1*dz);
ff = [f11 f12; f21 f22];
F = ff*F;
end
r3(r) = F(2,1)/F(1,1); %amplitude reflection coefficient
R3(r) = (abs(r3(r)))^2; %power reflection coefficient
%of single grating
PHI = 2*pi*neff*dzo/w; %phase difference between gratings
Fp = [exp(-1i*PHI) 0; 0 exp(1i*PHI)];
Ffp = F*Fp*F;
t3(r) = 1/Ffp(1,1); %amplitude transmission coefficient
T3(r) = (abs(t3(r)))^2; %power transmission coefficient of
%Fabry-Perot filter
end
%==================================================================
%Calculate Delay and Dispersion of Fabry-Perot Filter
theta = phase(r3);
dtheta1 = gradient(theta, h);
dtheta2 = gradient(dtheta1, h);
DELAY3 = -((wal.^2)./(2*pi*c)).*dtheta1;
DELAYu3 = DELAY3*1e12; %delay in (ps)
DISPERSION3 = (2*DELAY3./wal) - ((wal.^2)./(2*pi*c)).*dtheta2;
DISPERSIONu3 = DISPERSION3*(1e12/1e9); %dispersion in (ps/nm)
%=====================================================================
%Plots for reflection and transmission spectra for Bragg reflector and
%Fabry-Perot filter respectively
figure (1)
plot(wal*1e9, R3, 'k')
grid
axis([1549 1551.5 0 0.2])
title('Reflection Spectrum of Bragg Reflector')
xlabel('Wavelength (nm)')
ylabel('Power (p.u)')
figure (2)
plot(wal*1e9, T3, 'k')
grid
axis([1549 1551.5 0.4 1])
title('Transmission Spectrum of the Fabry-Perot Filter')
xlabel('Wavelength (nm)')
ylabel('Power (p.u)')
figure (3)
plot(wal*1e9, DELAYu3, 'k')
grid
axis([1545 1550 0.002 0.2])
title('Delay Spectrum of the Fabry-Perot Filter')
xlabel('Wavelength (nm)')
ylabel('Delay (ps)')
figure (4)
plot(wal*1e9, DISPERSIONu3, 'k')
grid
axis([1545 1550 -3 5])
title('Dispersion Spectrum of the Fabry-Perot Filter')
xlabel('Wavelength (nm)')
ylabel('Dispersion (ps)')
%====================================================================
显示我错误使用 + 矩阵维度必须一致,但我找不出来
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
2条回答 默认 最新
- Toblerone_Wind 2019-09-09 13:28关注
你好,你的matlab知识还是有所欠缺。
neff = 1+v*cos(cos(t)+2*pi*z/dz); %core index of fibre
中间应为2*pi*z./dz
漏了这个点本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 2无用
悬赏问题
- ¥15 网上下载的3DMAX模型,不显示贴图怎么办
- ¥15 关于#stm32#的问题:寻找一块开发版,作为智能化割草机的控制模块和树莓派主板相连,要求:最低可控制 3 个电机(两个驱动电机,1 个割草电机),其次可以与树莓派主板相连电机照片如下:
- ¥15 Mac(标签-IDE|关键词-File) idea
- ¥15 潜在扩散模型的Unet特征提取
- ¥15 iscsi服务无法访问,如何解决?
- ¥15 感应式传感器制作的感应式讯响器
- ¥15 如何使用SC92F8003固件库解析私有协议数据?
- ¥15 如何在音频中嵌入字符串(水印)信息进行传递
- ¥30 plc怎么以设计说明书申请软著
- ¥15 硬盘识别不了,需要初始化,可我的数据怎么办