How to use spectrum analyzer object to show a signal waveform ?

1 view (last 30 days)
I am using the function SpectrumAnalyzer. How do I use it with a waveform?
Fs = 2500; Sineobject1 = dsp.SineWave('SamplesPerFrame',1024,'SampleRate',Fs,'Frequency',100); Sineobject2 = dsp.SineWave('SamplesPerFrame',1024,'SampleRate',Fs,'Frequency',1000); SA = dsp.SpectrumAnalyzer('SampleRate',Fs,'NumInputPorts',2,'PlotAsTwoSidedSpectrum',... false,'ChannelNames',{'SinewaveInput','NotchOutput'},'ShowLegend',true);

Accepted Answer

Honglei Chen
Honglei Chen on 12 Sep 2016
You can set FrequencyResolutionMethod to 'Window length' to manually adjust the length of signal used to compute the spectrum, e.g.,
Fs = 2500;
Sineobject1 = dsp.SineWave('SamplesPerFrame',1024,'SampleRate',Fs,'Frequency',100);
Sineobject2 = dsp.SineWave('SamplesPerFrame',1024,'SampleRate',Fs,'Frequency',1000);
SA = dsp.SpectrumAnalyzer('SampleRate',Fs,'NumInputPorts',2,'PlotAsTwoSidedSpectrum',...
false,'ChannelNames',{'SinewaveInput','NotchOutput'},'ShowLegend',true,...
'FrequencyResolutionMethod','WindowLength');
step(SA,step(Sineobject1),step(Sineobject2))

More Answers (0)

Community Treasure Hunt

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

Start Hunting!