How can have the Filter Designer's "Overlay Spectrum" feature in the FDATool in the Signal Processing Toolbox?

4 views (last 30 days)
I like the Filter Designer's "Overlay Spectrum" feature, but now I'd like to use the FDATool instead, and cannot figure out how to do the analogous thing in the FDATool.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
The ability to overlay spectrums is not available in the FDATool in the Signal Processing Toolbox.
As a workaround, you can use the FDATool's "User-defined Spectral Mask" feature to display the spectum. Here, the "mtlb" signal will be used as an example.
After you have a version of the filter designed (so it is showing the magnitude response):
1. In the SPTool, use File->Export... to export the "mtlbse" spectrum to the base workspace.
2. Execute the following in the command window:
pvals = mtlbse.P((mtlbse.f>=0) & (mtlbse.f<=mtlbse.Fs/2));
fvals = mtlbse.f((mtlbse.f>=0) & (mtlbse.f<=mtlbse.Fs/2));
freq = fvals/(mtlbse.Fs/2);
mag = 20*log10(pvals);
Here, the variables "freq" and "mag" represent the spectrum, trimmed to the visible area and configured to have the default frequency and magnitude units.
3. Select View->User-defined Spectral Mask... in the FDATool
4. In the resulting dialog box,
a) check "Enable Mask"
b) enter "freq" (without quotes) for the "Frequency Vector"
c) enter "mag" (without quotes)for the "Magnitude Vector"
d) press "Apply"
This should display the spectrum.
Note that if go back and modify the displayed spectrum, you will find "freq" and "mag" have been replaced by very long strings representing the vectors. You can place your cursor in these edit boxes and use SHIFT+HOME or SHIFT+END to select the entire contents, and then press DELETE to clear the edit box.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!