?? calcsnrs.m
字號:
%CALCSNRS calculates the signal to noise ratio in each subchannel.% [Si,Mi,Ui,Ni,Ci,Ii] = CALCSNRS(Sx,H,Sn,G) returns the SNRs in Si是信躁比矩陣and the % matched filter bound in the used subchannels in Mi是去掉不用的信道之后的信躁比矩陣. The used channel are% those which can support at least 2 bits with the given SNR gap in G.% The used channels are returned in Ui, the used noise spectrum in Ni, the% used channel gains in Ci and the used input spectrum in Ii.% % Sx is the raw input power spectrum, H the channel gain squared, Sn% the channel noise power spectrum and G the snr gap in dB.function [initSNRi,MFBi,usedChannels,noiseSpec,channelGain,inputSpec] = ... calcsnrs(initInputSpec,initChannelGain,initNoiseSpec,gamma)N = (length(initInputSpec)-1)*2;%calculate SNRi for Sx = 1;initSNRi = initInputSpec.*initChannelGain./initNoiseSpec; %Eliminate useless channels, first assume all usable%channels 估計無用的信道,先假定所有的信道有用。usedChannels = ones(1,N/2+1) == 1;%usedChannels = ones(1,N/2+1)?%SNR required to carry 2 bits with given gap能傳輸2bit所要求的信躁比SNR2bits = gamma*(2^2-1);%Do not use subchannels which cannot carry 2 bits%usedChannels = initSNRi >= SNR2bits;%Do not use DC and Nyquist subchannelsusedChannels(1) = 0;usedChannels(N/2+1) = 0;%Do not use POTS bandusedChannels(2:6) = 0;if sum(usedChannels) == 0 warning('Not enough transmit power to transmit any bits through the channel'); warning('RESULTS ARE NOT VALID'); usedChannels(1) = 1;end%noise and channel gain in used channels noiseSpec = initNoiseSpec(usedChannels);channelGain = initChannelGain(usedChannels);inputSpec = initInputSpec(usedChannels);%matched filter bound if available power would be distributed %over the entire bandwidthMFBi = inputSpec.*channelGain./noiseSpec;%MFBiall = initInputSpec.*initChannelGain./initNoiseSpec;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -