using channels and getMeasurementsData in dsp.SpectrumAnalyzer
11 views (last 30 days)
Show older comments
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.
0 Comments
Answers (1)
Meet
on 15 Nov 2024 at 5:20
Edited: Walter Roberson
on 15 Nov 2024 at 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!!
0 Comments
See Also
Categories
Find more on Spectral Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!