get the data of dsp.spectrum Analyzer

조회 수: 6 (최근 30일)
MAWE
MAWE 2022년 8월 30일
댓글: MAWE 2022년 8월 31일
Currently, I am using the below code to display the spectrum of the received signal (before receive filtering) using dsp.spectrumAnalyzer. However, I need the data that is shown itself. How can I get it? Also, how can I generate the spectrum as dsp.spectrumAnalyzer manully from sctractch using fft?
data = 2.*randi([0 1], 1e6, 1)-1;
txFilter = comm.RaisedCosineTransmitFilter;
filteredData = txFilter(data);
rxSignal = awgn(filteredData, 20);
freqAnalyzer = dsp.SpectrumAnalyzer('SampleRate',8e6);
freqAnalyzer((rxSignal));

채택된 답변

Abderrahim. B
Abderrahim. B 2022년 8월 30일
Hi!
To get data shown in spectrum analyzer, use getSpectrumData method.
data = 2.*randi([0 1], 1e6, 1)-1;
txFilter = comm.RaisedCosineTransmitFilter;
filteredData = txFilter(data);
rxSignal = awgn(filteredData, 20);
freqAnalyzer = dsp.SpectrumAnalyzer('SampleRate',8e6) ;
freqAnalyzer((rxSignal))
specData = getSpectrumData(freqAnalyzer) ;
figure
plot(specData.FrequencyVector{1,1}, specData.Spectrum{1,1})
Hope this helps
  댓글 수: 1
MAWE
MAWE 2022년 8월 31일
It seems the specData.Spectrum{1,1} is the absolute value since it's real. If the signal is complex by adding some noise like below, how can I get the complex frequency representation? In other words, how can I get the same spectrum from the fft of rxSignal?
data = 2.*randi([0 1], 1e6, 1)-1;
txFilter = comm.RaisedCosineTransmitFilter;
filteredData = txFilter(data);
L=length(filteredData);
n=(1/(sqrt(2*10^2))).*(randn(L,1)+1i.*randn(L,1))
rxSignal = filterData + n;
freqAnalyzer = dsp.SpectrumAnalyzer('SampleRate',8e6) ;
freqAnalyzer((rxSignal))
specData = getSpectrumData(freqAnalyzer) ;
figure
plot(specData.FrequencyVector{1,1}, specData.Spectrum{1,1})

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Spectral Measurements에 대해 자세히 알아보기

태그

제품


릴리스

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by