|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
谁能给个代码的框架啊。。用simulink仿真后不知怎么计算信噪比,郁闷。。或者谁能帮我看看下面的代码:
W=blackman(np); %Define a window of length np
[ys,f] = psd(ya,np,fs,W,[ ]);
%Use build-in Matlab ‘psd’ function
psdy = ys*norm(W)^2/sum(W)^2/(fs/np);
%Reverse norm and windowing
Subtraction of the input signal at fsig from the PSD:
fsignr = round(fsig/(fs/(np));
% Which bin contains the signal peak
%Find approx. number of bins (n) with leakage
comp = psdy(fsignr); n = 1; %Start at signal frequency
while (min(psdy((fsignr+n)fsignr1+n+10)))<vergl),。。。。。。。。。。。。。。。。。。(1)
comp=psdy(fsignr+n); n=n+1; % Enlarge n while there is
end; % still signal over the noise
psdy2 = psdy; %Copy the PSD-vector
psdy2(fsignr-n:fsignr+n) =
~~~~~~~~~~~~~(psdy(fsignr-n)+psdy(fsignr-n))/2;
%Replace signal peak by medium
% PSD-noise-magnitude around it
Determination of the integrated in-band noise [0, fB] from the PSD:
psdy2_bin = psdy2*(fs/np);
%Calculate the power of each bin
fbnr = round(fb/(fs/(np));
%Which bin is at the bandwidth’s edge
IBN = sum(psdy2_bin(0:fbnr))
214 A Program Code
Calculation of the output signal-to-noise ratio from the PSD:
psdy_bin = psdy*(fs/np); %Calculate power of each bin,
%here including the signal peak
SNR = sum(psdy_bin) - sum(psdy2_bin);
%Total integrated power minus
% total integrated power without signal
标着。。。(1)的那行中的fsignr1和verg1是什么东西啊?前面也没有定义。。跪求高人。。 |
|