我是靠谱客的博主 搞怪煎蛋,最近开发中收集的这篇文章主要介绍OFDM专题之如何计算OFDM一个符号的功率,功率谱密度,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

1. matlab帮助文档中通过计算方差的形式来计算OFDM一个符号的功率

    1):>>doc 《QPSK and OFDM with MATLAB System Objects》

         代码如下:为什么是利用方差呢?直接利用如下公式不行吗?对比结果发现,相差很少。

txSig_erg=sum(abs(txSig).^2);

10*log10(txSig_erg/length(txSig));

        

dataIn = randi([0,1],frameSize);              % Generate binary data
qpskTx = qpskMod(dataIn);                     % Apply QPSK modulation
txSig = ofdmMod(qpskTx);                      % Apply OFDM modulation
powerDB = 10*log10(var(txSig));               % Calculate Tx signal power

注意: 功率和功率普密度不是同一个概念哦!!

2. 如何计算一个OFDM符号的功率谱密度

有两种计算方式,请参考如下matlab帮助文档

1):>>doc  periodogram函数,有详细的参考公式

2):>>doc  《Power Spectral Density Estimates Using FFT》

  

%% 对比两种计算功率谱密度的方法,一个采用FFT,一个采用periodogram函数
%% 以下是计算实信号的功率谱密度
rng default
Fs = 1000;
t = 0:1/Fs:1-1/Fs;
x = cos(2*pi*100*t) + randn(size(t));

N = length(x);
xdft = fft(x);
xdft = xdft(1:N/2+1);
psdx = (1/(Fs*N)) * abs(xdft).^2;
psdx(2:end-1) = 2*psdx(2:end-1); % 此处为什么要乘以2呢???
freq = 0:Fs/length(x):Fs/2;

plot(freq,10*log10(psdx))
grid on
title('Periodogram Using FFT')
xlabel('Frequency (Hz)')
ylabel('Power/Frequency (dB/Hz)')

periodogram(x,rectwin(length(x)),length(x),Fs)
mxerr = max(psdx'-periodogram(x,rectwin(length(x)),length(x),Fs))

%% 以下计算复数信号的功率谱密度
rng default
n = 0:999;
x = exp(1j*pi/4*n) + [1 1j]*randn(2,length(n))/sqrt(2);

%% Use fft to obtain the periodogram. Because the input is complex-valued, obtain the 
%% periodogram from  rad/sample. Plot the result.

N = length(x);
xdft = fft(x);
psdx = (1/(2*pi*N)) * abs(xdft).^2;% 计算复信号时没有乘以2!!!这是为什么???
freq = 0:(2*pi)/N:2*pi-(2*pi)/N;
%% 
plot(freq/pi,10*log10(psdx))
grid on
title('Periodogram Using FFT')
xlabel('Normalized Frequency (timespi rad/sample)') 
ylabel('Power/Frequency (dB/rad/sample)')
%% 
periodogram(x,rectwin(length(x)),length(x),'twosided')
mxerr = max(psdx'-periodogram(x,rectwin(length(x)),length(x),'twosided'))

%% 归一化频率时的计算方式如下
Input with Normalized Frequency
Use fft to produce a periodogram for an input using normalized frequency. Create a signal consisting of a sine wave in N(0,1) additive noise. The sine wave has an angular frequency of  rad/sample. Use the default settings of the random number generator for reproducible results.
%% 
rng default
n = 0:999;
x = cos(pi/4*n) + randn(size(n));
%% 
Obtain the periodogram using fft. The signal is real-valued and has even length. Because the signal is real-valued, you only need power estimates for the positive or negative frequencies. In order to conserve the total power, multiply all frequencies that occur in both sets -- the positive and negative frequencies -- by a factor of 2. Zero frequency (DC) and the Nyquist frequency do not occur twice. Plot the result.
%% 

N = length(x);
xdft = fft(x);
xdft = xdft(1:N/2+1);
psdx = (1/(2*pi*N)) * abs(xdft).^2;
psdx(2:end-1) = 2*psdx(2:end-1);
freq = 0:(2*pi)/N:pi;
%% 

plot(freq/pi,10*log10(psdx))
grid on
title('Periodogram Using FFT')
xlabel('Normalized Frequency (timespi rad/sample)') 
ylabel('Power/Frequency (dB/rad/sample)')

%% Compute and plot the periodogram using periodogram. Show that the two results are identical.

periodogram(x,rectwin(length(x)),length(x))
mxerr = max(psdx'-periodogram(x,rectwin(length(x)),length(x)))
mxerr = 1.4211e-14

二者计算的结果是一样的,第二种方法更加具体,是利用FFT来计算,相当于是第一种方法的具体实现过程

       

最后

以上就是搞怪煎蛋为你收集整理的OFDM专题之如何计算OFDM一个符号的功率,功率谱密度的全部内容,希望文章能够帮你解决OFDM专题之如何计算OFDM一个符号的功率,功率谱密度所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(61)

评论列表共有 0 条评论

立即
投稿
返回
顶部