How to plot 2 data graph use freqz

18 views (last 30 days)
Mano Moritani
Mano Moritani on 21 May 2021
Answered: Naoya on 24 May 2021
I want to plot 2 date.
when I use " hold" can to plot 2 data at only Magnitude-Frequency.
i want to ploto 2 them at Degree-Frequency.
------code------
freqz(h1,1)
hold on
freqz(h2,1)
legend(LEG_NAME1,LEG_NAME2,'Location',LEG_LOCATION);
set(legend,'Fontname','Times New Roman','Fontsize',LEG_FSIZE,'EdgeColor','k','LineWidth',OUTLINE_WIDTH);
hold off

Answers (1)

Naoya
Naoya on 24 May 2021
% freqz を hold on して重ね描きされる際は、以下の様に freqz に戻り値を付けていただきますと、振幅/位相応答共に重ね表示することができます。
% 2種類のFIRフィルタの周波数応答データを取得
[H1,W1] = freqz(rand(1,5),1);
[H2,W2] = freqz(rand(1,5),1);
% 振幅表示
subplot(2,1,1)
plot(W1, 20*log10(abs(H1)))
hold on
plot(W2, 20*log10(abs(H2)))
% 位相表示
subplot(212)
plot(W1, unwrap(angle(H1))*180/pi)
hold on
plot(W2, unwrap(angle(H2))*180/pi)

Categories

Find more on Vector Fields 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!