📄 fun_main.m
字号:
clear;
clc;
alfa=3.0; %线宽增强因子
gmae=6.21e-4*1e12; %反转离子数寿命
C=1.059; %注入电流
taoL=8.5e-12; %腔内时间
lmg= 1.51e-6; %增益峰值频率w0*tao=0mod(2*pi)
wc=4*pi*1e14;
deltw=0;%2*pi*21.17e12; %材料增益宽度
qqq=1:20;
wjg=2.*pi.*(qqq.*2e8-2e9);
KKK=(0.022-0.0141+0.00141.*qqq).*1e12;
% for ii=1:20
s=1.0e-7; %饱和系数
beta=5e-10*1e12; %自发辐射速率
gc=3.2e-9*1e12; %微分增益系数
N0=1.25e8; %透明载流子数
gma=0.238e12; %腔内损耗
%********************* 常用可变量 ****************************
kt=0; %反馈强度 **
taot=5e-6; %反馈延迟时间 **
%%
kc=0; %注入接受偶合系数 % 可变量 **
taoc=5e-6; %注入接受偶合时间 **
kk=0; %注入解调偶合系数 % 可变量 **
taok=5e-6; %注入解调偶合时间 **
%%
% kc=0.5e12; %注入接受偶合系数 % 可变量 **
% taoc=4e-9; %注入接受偶合时间 **
% kk=0.1e12; %注入解调偶合系数 % 可变量 **
% taok=4e-9; %注入解调偶合时间
% for iii=1:20
% deltw=wjg(iii);
%******************************************************************
t0=0; %初始时间点
h=4e-3*1e-9; %取样时间间隔
Th=h*(2^15); %总时间宽度
%******************************************************************
% 1 发射系统计算 **
%**************************加上调制电流信号************************
P0=0.4; %信号强度
% sign=2.499e8; %加上信号的频率
sign=1e9; %加上信号的频率
CC=ssignal(C,P0,sign,h,Th);
% CC=C*ones(1,length(0:h:Th)); % 测试信号
%%****************************
At0=0.8704e-1; % 发射端的初始条件设定
fait0=0;
Nt0=2*(N0+gma/gc);
% 四界龙格-库塔算法
[t,A,fai,N]=runge_kutta(At0,fait0,Nt0,kt,h,taot,Th,CC,C,deltw);
figure(2)
subplot(3,1,1)
plot(t(1:length(t)-4999).*1e9,A(5000:end),'k');grid on;
title('A ');
subplot(3,1,2)
plot(t(1:length(t)-4999).*1e9,fai(5000:end),'k');grid on;
title('fai');
subplot(3,1,3)
plot(t(1:length(t)-4999).*1e9,N(5000:end),'k');grid on;
title('N');
figure(3)
plot(N(5000:end),fai(5000:end),'k');grid on;
title('A ');
% ttt=(0:h:Th); %%%%%%%%%taotao为信号周期, 理想的正玄信号%%%%%%%%%%%
% taotao=1/sign;
% TTT=ttt-30e-9;
%
% for i=1:length(TTT)
% if TTT(i)<0
% ccc(i)=C;
% else
% ccc(i)=C*(1+P0/2*sin(2*pi*sign*TTT(i)));
% end
% end
% A=(1+(ccc-C)./C).*A;
%******************************************************************
% 2 接受系统计算 **
%%*****************************************************************
Ar0=0.8704e-1;
fair0=0;
Nr0=1.14*(N0+gma/gc);
%四界龙格-库塔算法
[tr,Ar,fair,Nr]=runge_kutta_r(11,Ar0,fair0,Nr0,A,fai,kc,h,taoc,Th,C,deltw);
%%*****************************************************************
%% 3 解调系统计算
% Ak0=0.8704e-1;
% faik0=0;
% Nk0=1.14*(N0+gma/gc);
% %四界龙格-库塔算法
% [tk,Ak,faik,Nk]=runge_kutta_r(Ar0,fair0,Nr0,Ar,fair,kc,h,taoc,Th,C,deltw);
% %**************************得到总的摸****************************
A=abs(A);
Ar=abs(Ar);
% Ak=abs(Ak);
% %
% deltime=ceil(taot/h);
% %
% Newt=t(1:length(A)-deltime);
% AA=A(1:length(A)-deltime);
% AAr=Ar(1+deltime:end);
% AAk=Ak(1+deltime:end);
% %%%
% Newt=t(1:length(A)-2*deltime-1);
% AA=A(1:length(A)-2*deltime-1);
% AAr=Ar(1+deltime:length(Ar)-deltime-1);
% AAk=Ak(2+2*deltime:end);
% Newt=t(1:length(A)-deltime);
% AA=A(1:length(A)-deltime);
% AAr=Ar(1:length(A)-deltime);
% AAk=Ak(1+deltime:end);
%
% %%*******************************************************
% Ar=(mean(A.^2))^(1/2)/(mean(Ar.^2))^(1/2).*Ar;
% Ak=(mean(Ar.^2))^(1/2)/(mean(Ak.^2))^(1/2).*Ak;
% AAk=(mean(AAr.^2))^(1/2)/(mean(AAk.^2))^(1/2).*AAk;
% %**************************画图区*******************************************************************
% figure(1)
% subplot(4,1,1)
% plot(t,A,'r');grid on;
% title('transmitter ');
%
% subplot(4,1,2)
% plot(t,Ar,'b');grid on;
% title('receiver ');
% subplot(4,1,3)
% plot(t,Ak,'g');grid on;
% title('dector');
%
% subplot(4,1,4)
% plot(t,Ar-Ak,'r');grid on;
% xlabel('time');
% title('rule signal');
% %%********自我关联函数******************
% [delt,y2]=cross_correlation(A,Ar,h,t)
% [delt,y3]=cross_correlation(Ar,Ak,h,t)
% figure(2)
% plot(delt,y2);
% hold on
% plot(delt,y3,'r');
%%%%%%%%%%%%%功率谱%%%%%%%%%%%%%%%%%%%%%%%%
% [WA,WAr,sWAr,ww]=powerspectrum(Ar,Ak,h,t)
% figure(3)
% subplot(3,1,1)
% plot(ww,10*log(WA));
% title('transmitter laser');
%
% subplot(3,1,2)
% plot(ww,10*log(WAr));
% title('receiver laser');
%
% subplot(3,1,3)
% plot(ww,10*log(sWAr));
% title('rule signal');
%%%%%%%%%%%%%滤波器%%%%%%%%%%%%%%%%%%%%%%%%%%%
% [Ttt,lasgnal]=myfilter(sign,A,Ar,h,t)
% figure(4)
% plot(2*Ttt,lasgnal)
% hold on
% plot(t,1+600*CC-600*C,'k');
%
% [Ttt,lasgnall]=myfilter(sign,Ar,Ak,h,t)
% figure(5)
% plot(2*Ttt,lasgnall)
% hold on
% plot(t,1+600*CC-600*C,'k');
[GG] =transfunction(A(250:end),Ar(250:end),Nr(250:end),fair(250:end),kt);
QQQ(ii,iii)=GG;
end
end
[x,y]=meshgrid(wjg,KKK);
mesh(x,y,QQQ);
% figure(7)
% if ii==1
% plot(1e-2*ff,10*log10(GG),'r-.');
% hold on;
% end
% if ii==2
% plot(1e-2*ff,10*log10(GG),'y-.');
% hold on;
% end
% if ii==3
% plot(1e-2*ff,10*log10(GG),'g');
% hold on;
% end
% if ii==4
% plot(1e-2*ff,10*log10(GG),'b--');
% hold on;
% end
% if ii==5
% plot(1e-2*ff,10*log10(GG),'m.--');
% end
%
% end
% %%%%%%%%***************************************************************************************
%%%%%%%****************************************************************************************
% figure(1)
% subplot(4,1,1)
% plot(Newt,AA,'r');grid on;
% title('transmitter ');
%
% subplot(4,1,2)
% plot(Newt,AAr,'b');grid on;
% title('receiver ');
%
% subplot(4,1,3)
% plot(Newt,AAk,'g');grid on;
% title('dector');
%
% subplot(4,1,4)
% plot(Newt,AAr-AAk,'r');grid on;
% xlabel('time');
% title('rule signal');
% %%********自我关联函数******************
% [delt,y2]=cross_correlation(AA,AAr,h,Newt)
% [delt,y3]=cross_correlation(AAr,AAk,h,Newt)
% figure(2)
% plot(delt,y2);
% hold on
% plot(delt,y3,'r');
% %%%%%%%%%%%%%功率谱%%%%%%%%%%%%%%%%%%%%%%%%
% [WA,WAr,sWAr,ww]=powerspectrum(AAr,AAk,h,Newt)
% figure(3)
% subplot(3,1,1)
% plot(ww,10*log(WA));
% title('transmitter laser');
%
% subplot(3,1,2)
% plot(ww,10*log(WAr));
% title('receiver laser');
%
% subplot(3,1,3)
% plot(ww,10*log(sWAr));
% title('rule signal');
% %%%%%%%%%%%%%滤波器%%%%%%%%%%%%%%%%%%%%%%%%%%%
% [Ttt,lasgnal]=myfilter(sign,AA,AAr,h,Newt)
% figure(4)
% plot(2*Ttt,lasgnal)
% hold on
% plot(t,1+600*CC-600*C,'k');
%
% [Ttt,lasgnall]=myfilter(sign,AAr,AAk,h,Newt)
% figure(5)
% plot(2*Ttt,lasgnall)
% hold on
% plot(t,1+600*CC-600*C,'k');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -