matlab ebno函数,matlab自带的求解功率谱的函数有问题?

clear all;

close all;

clc

Fc =  1.525e9 ;         % Carrier frequency (Hz)

Rsym = 23400;         % Symbol rate (symbols/second)

nSamps = 8;         % Number of samples per symbol

frameLength = 2048; % Number of symbols in a frame

M = 16;             % Modulation order (16-QAM)

EbNo = 15;          % Ratio of baseband bit energy

% to noise power spectral density (dB)

% Calculate sampling frequency in Hz

Fs = Rsym * nSamps;

% Calculate passband SNR in dB. The noise variance of the baseband signal

% is double that of the corresponding bandpass signal [1]. Increase the SNR

% value by 10*log10(2) dB to account for this difference and have

% equivalent baseband and passband performance.

SNR = EbNo + 10*log10(log2(M)/nSamps) + 10*log10(2);

% Create a scatter plot scope for received symbols.

scatScope = commscope.ScatterPlot('SamplingFrequency', Rsym, ...

'SamplesPerSymbol', 1); close(scatScope)

% Create a 16-QAM modulator.

hMod = modem.qammod('M',M);

% Set the expected constellation of the scatter plot scope.

scatScope.Constellation = hMod.Constellation;

scatScope.PlotSettings.Constellation = 'on';

scatScope.PlotSettings.ConstellationStyle = '*r';

% Generate random data symbols.

b = randi([0 hMod.M-1], frameLength, 1);

% Modulate the random data.

txSym = modulate(hMod, b);

% Specify a square root raised cosine filter with a filter length of eight

% symbols and a rolloff factor of 0.2.

nSym = 8;       % Length of the filter in symbols

beta = 0.2;     % Rolloff factor

filterSpec = fdesign.pulseshaping(nSamps, 'Square root raised cosine', ...

'Nsym,Beta', nSym, beta);

% Design the transmitter filter.

hXmtFlt = design(filterSpec);

% Apply pulse shaping by upsampling and filtering.  Alternatively, you can

% use an efficient multirate filter. See help for fdesign.interpolator for

% more information.

x = filter(hXmtFlt, upsample(txSym, nSamps));

% Plot spectrum estimate of pulse shaped signal.

figure;

pwelch(x,hamming(512),[],[],Fs,'centered')

% Generate carrier. The sqrt(2) factor ensures that the power of the

% frequency upconverted signal is equal to the power of its baseband

% counterpart.

t = (0:1/Fs:(frameLength/Rsym)-1/Fs).';

carrier = sqrt(2)*exp(1i*2*pi*Fc*t);

% Frequency upconvert to passband.

xUp = real(x.*carrier);

% Plot spectrum estimate.

pwelch(xUp,hamming(512),[],[],Fs,'centered')

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值