matlab程序求解释(详细点)
发布网友
发布时间:2023-06-26 11:09
我来回答
共2个回答
热心网友
时间:2023-10-18 03:16
function dispersion_disp(path,pitch)
%display the dispersion calculated by the multipole method.
if nargin<2
pitch=1;
end
fid=fopen(path,'r');
data=fscanf(fid,'%f');
lambda=data(1:3:length(data));
neff=data(2:3:length(data));
%nimag=data(3:3:length(data));
figure;plot(lambda,neff);
%figure;plot(lambda,nimag);
fclose(fid);
wavelength=1.55e-6.*lambda/pitch;
d1=diff(neff);
w1=diff(wavelength);
d2=diff(d1./w1);
% w2=diff(w1);
c=2.99792458e8;
dispersion=-1.*wavelength(3:length(wavelength))./c.*d2./w1(2:length(w1));
figure;plot(wavelength(3:length(wavelength))*1e9,dispersion*1e6);title('wavelength vs dispersion');
xlabel('nm');ylabel('ps/km.nm');
龙 12:54:32
function dispersion_disp(path,pitch)%构建函数,两个变量,其中一个是路径
%display the dispersion calculated by the multipole method.
if nargin<2%如果输入参数的个数小于2则以下结果
pitch=1;
end
fid=fopen(path,'r');%打开路径下的数据文件
data=fscanf(fid,'%f');%读入文件数据
lambda=data(1:3:length(data));%设置lambda的值
neff=data(2:3:length(data)); %设置neff的值
%nimag=data(3:3:length(data));
figure;plot(lambda,neff);%绘图
%figure;plot(lambda,nimag);
fclose(fid);
wavelength=1.55e-6.*lambda/pitch;
d1=diff(neff);%求差值
w1=diff(wavelength);
d2=diff(d1./w1);
% w2=diff(w1);
c=2.99792458e8;
dispersion=-1.*wavelength(3:length(wavelength))./c.*d2./w1(2:length(w1));%计算dispersion
figure;plot(wavelength(3:length(wavelength))*1e9,dispersion*1e6);title('wavelength vs dispersion');%图形绘制
xlabel('nm');ylabel('ps/km.nm');追问能发个邮箱吗,我把数据发给你。
追答1017044504@qq。com
热心网友
时间:2023-10-18 03:16
一个方程定义