clear;
clc;
lamda=1550e-9;
fs=500e6;
T=400e-9;
w=sqrt(log(2))/(sqrt(2)*pi*T*fs);
M=T*fs;
N=[100,1000,10000];
LineSpec=[':','.-','-']
for i=1:length(N)
N1=N(i);
line=LineSpec(i);
CNR1=linspace(-40,10,50);
CNR=10.^(CNR1/10);
V_cr1=zeros(1,50);
qianzhixishu1=lamda*fs*w/(2*sqrt(N1*M));
for index=1:50;
houzhixishu=@(f)(f./w).^2./(1+(CNR(index)./(sqrt(2*pi).*w).*exp(-f.^2./(2.*w.^2))).^-1).^2;
res=integral(houzhixishu,-1/2,-1/2);
V_cr1(index)=qianzhixishu1*(res.^(-1/2));
end
semilogy(CNR1,V_cr1,line);hold on
end
title('V_c_r_l_b with CNR');
ylabel('V_c_r_l_b(m/s)');
xlabel('CNR(dB)');
ylim([1e-3,1e1])
lgd=legend({'N=100','N=1000','N=10000'});
title(lgd,'N');
版本R2020b
求大佬救救孩子!!!

 Réponse acceptée

0 votes

你的 res 按积分算出来是0,导致后面 res.^(-1/2) 这一步运算使数值变成了没法绘制的 inf。
至于更底层的原因,你得自己回去检查公式写对没写对、计算精度够不够之类。

Plus de réponses (0)

Catégories

En savoir plus sur Physics dans Centre d'aide et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!