Need explanation on plotting frequency response of a causal discrete-time LTI system implemented using the difference equation.

조회 수: 6 (최근 30일)
So....
i have a program like this
RH_coeff=[0.1 -0.1176 0.1];% Coefficient of x on RHS of difference equation
LH_coeff=[1 -1.7119 0.81]; % Coefficient of y on LHS of difference equation
%% Frequency response of the filter
[H,w]=freqz(RH_coeff,LH_coeff); % Frequency response
plot(w/(2*pi),20*log10(abs(H)),'LineWidth',1.5); % Plot Frequency response
xlabel('Normalized frequency (f/fs)Hz');
ylabel('Magnitude');
title('Frequency response');
grid;
%% Generating response y[n] due to input x[n]
n=0:100;% X axis
xn=cos(0.1*n*pi);% x[n]
yn=filter(RH_coeff,LH_coeff,xn); %y[n]
figure;
subplot(2,1,1);
stem(n,xn); %Plot input
xlabel('n');
ylabel('x(n)');
title('Input sequence');
subplot(2,1,2);
stem(n,yn);% Plot output
xlabel('n');
ylabel('y(n)');
title('Output sequence');
grid;
  1. Can someone explain to me what [H,w]=freqz(RH_coeff,LH_coeff); means? does it mean H=RH_coeff, w=LH_coeff?
  2. what does this function (plot(w/(2*pi),20*log10(abs(H)),'LineWidth',1.5);) means? why does this function exist? i thought for plotting frequency responce i just stopped at freqz(RH_coeff,LH_coeff);

채택된 답변

Star Strider
Star Strider 2022년 5월 16일
does it mean H=RH_coeff, w=LH_coeff?
No. The first argument are the numerator coefficients of the filter transfer function, and the second argument are the denominator coefficients.
what does this function (plot(w/(2*pi),20*log10(abs(H)),'LineWidth',1.5);) means?
It plots the magnitude section of the Bode plot created by freqz as the frequency in Hz and magnitude in dB.
.
  댓글 수: 4
Evelio Excellenta
Evelio Excellenta 2022년 5월 18일
thankyou~
ok now i know that [H,w] is the output of freqz.
now my question is does [H,w] has name? because im preparing for presentation and i don't know what to call it.
should i just call it by the alphabet H and w? or H means frequency and w is magnitude? or just call it a variable?
Star Strider
Star Strider 2022년 5월 18일
The ‘H’ output is the complex transfer function, and ‘w’ are the associated radian frequencies.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Digital Filter Analysis에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by