using channels and getMeasurementsData in dsp.SpectrumAnalyzer

11 ビュー (過去 30 日間)
Michael Hansen
Michael Hansen 2021 年 10 月 7 日
編集済み: Walter Roberson 2024 年 11 月 15 日 5:39
Hello,
I have a dsp>spectrumAnalyzer object to which I have three traces. Display, Cursor measurments and manual trace selection works fine. Programatically I am having issues getting data for each trace (channel). I am attempting the following, however I only get channel one data in all calls.
scope.MeasurementChannel =1;
scope(tx_amp_out,tx_filt_out*tx_amp_gain_lin,tx_error);
data1 = getMeasurementsData(scope,'all');
scope.MeasurementChannel =3;
data3 = getMeasurementsData(scope,'all');
Please advise if there are additional details to get the respective channel measurements.

回答 (1 件)

Meet
Meet 2024 年 11 月 15 日 5:20
編集済み: Walter Roberson 2024 年 11 月 15 日 5:39
Hi Michael,
I encountered a similar issue. As a workaround, you can use the GUI for the Spectrum Analyzer to obtain measurements of those signals. Alternatively, you could create separate objects of "dsp.SpectrumAnalyzer" for each signal and then retrieve the measurement data from them.
For example, consider the code below, which analyzes two "SineWave" signals using separate "spectrumAnalyzer" objects.
Fs = 100e6; % Sample rate
fSz = 5000; % Frame size
sin1 = dsp.SineWave(1e0,5e6,0,SamplesPerFrame=fSz,SampleRate=Fs);
sin2 = dsp.SineWave(1e-1,15e6,0,SamplesPerFrame=fSz,SampleRate=Fs);
scope1 = dsp.SpectrumAnalyzer(SampleRate=Fs,AveragingMethod="exponential",RBWSource="auto",SpectrumUnits="dBW");
scope1.CursorMeasurements.Enable = true;
scope1.ChannelMeasurements.Enable = true;
scope1.PeakFinder.Enable = true;
scope1.DistortionMeasurements.Enable = true;
scope1(sin1())
data1 = getMeasurementsData(scope1);
disp(data1.DistortionMeasurements.Power);
scope2 = dsp.SpectrumAnalyzer(SampleRate=Fs,AveragingMethod="exponential",RBWSource="auto",SpectrumUnits="dBW");
scope2.CursorMeasurements.Enable = true;
scope2.ChannelMeasurements.Enable = true;
scope2.PeakFinder.Enable = true;
scope2.DistortionMeasurements.Enable = true;
scope2(sin2())
data2 = getMeasurementsData(scope2);
disp(data2.DistortionMeasurements.Power);
Note: Starting from MATLAB R2022a, support for "dsp.SpectrumAnalyzer" has ended. Therefore, it is recommended to use "spectrumAnalyzer" for MATLAB R2022a or later versions."
For more information, refer to the documentation link below:
Hope this helps!!

カテゴリ

Help Center および File ExchangeSpectral Analysis についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by