end i= i+1; end pe1(s) = length(find(panjue1~=in1))/num; % 基带误码率 pe2(s) = length(find(panjue2~=in1))/num; % 频带误码率 s= s+1; end figure(1); subplot(3,2,1); pwelch(in2,[],[],[],fs); title(' 基带信号频谱'); figure(1); subplot(3,2,2); pwelch(inn,[],[],[],fs); title(' 频带信号'); figure(1); subplot(3,2,4); plot(w1,h1); title(' 带通信号频谱'); figure(1); subplot(3,2,3); plot(w2,h2); title(' 低通信号频谱'); figure(1); subplot(3,2,5); pwelch(noise,[],[],[],fs); title(' 高斯白噪声信号频谱'); figure(1); subplot(3,2,6); pwelch(nwgnnoise,[],[],[],fs); title(' 窄带高斯信号频谱'); figure(3); SNR_db = -5:10; pelilun = 0.5*erfc(sqrt(10.^((SNR_db)./10))); semilogy(SNR_db,pe1,'-or');hold on; semilogy(SNR_db,pe2,'-ob');hold on; semilogy(SNR_db,pelilun,'-og'); legend(' 基带误码率曲线',' 频带误码率曲线',' 理论误码率曲线');grid on;hold on; xlabel('SNR_db'); ylabel('pe');