How to plot multiple filter response on the same filter visualizer?

19 vues (au cours des 30 derniers jours)
mostafa
mostafa le 26 Nov 2018
Commenté : mostafa le 26 Nov 2018
I have two filter responses and I would like to plot them on the same figure on the filter visulizer but I could not find any way to do it. I was trying to retrieve xData and yData but I could not find them in the figure handler of the filter visualizer.

Réponse acceptée

Honglei Chen
Honglei Chen le 26 Nov 2018
To get XData and YData of phase noise visualization, you can do the following
pn = comm.PhaseNoise;
h = visualize(pn);
x = h.CurrentAxes.Children.XData;
y = h.CurrentAxes.Children.YData;
HTH
  1 commentaire
mostafa
mostafa le 26 Nov 2018
I did the following instead of the code you sent and it works:
pn = comm.PhaseNoise ;
visualize(pn );
h = get(gcf);
x = h.CurrentAxes.Children.XData ;
y = h.CurrentAxes.Children.YData ;
Thank you,
Mostafa

Connectez-vous pour commenter.

Plus de réponses (2)

Honglei Chen
Honglei Chen le 26 Nov 2018
How do you describe your filter? The following example plots two filter responses in one figure and you should be able to do similar with your filters.
b1 = firpm(20,[0 0.4 0.5 1],[1 1 0 0]);
b2 = firpm(40,[0 0.4 0.5 1],[1 1 0 0]);
fvtool(b1,1,b2,1);
HTH

mostafa
mostafa le 26 Nov 2018
One problem with Matlab is that there is no integrity among different tools and definitions. For example, the DSP toolbox has its own way of defining filters, which is differetn from the way that communications toolbox does. I am using comm.PhaseNoise object. It has a "visualize" method which plots the response but if I could not find a way to plot another phase noise response on the same figure. I would like to plot two comm.PhaseNoise responses on the same figure.
Best,
Mostafa

Community Treasure Hunt

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

Start Hunting!

Translated by