フィルターのクリア

Frequency response of discrete PT1

25 ビュー (過去 30 日間)
MOC
MOC 2020 年 6 月 11 日
回答済み: MOC 2020 年 6 月 11 日
I want to calculate the frequency response of a discrete PT1 system with T=T1 and K=1. (the code is at the bottom of the question)
To validate the magnitude response, I want to use an sinusoidal input signal with linearly increasing frequency from 0 to fs/2.
The magnitude response should be the envelope of the transient response.
However, this is only the case if I change the line
u = sin(2*pi*f.*t);
to
u = sin(pi*f.*t);
Why? I assume that I have any kind of faulty reasoning here, but I can't find it.
Thanks in advance.
clear
%% Input (linear frequency sweep)
Ts = .1e-3;
duration = 30;
t = (0:Ts:duration);
fs = 1/Ts;
f = (fs/2)*t/duration;
u = sin(2*pi*f.*t);
%% PT1-system continuous
T1 = 1e-3;
G = tf(1,[T1 1]);
%% PT1 discretized
H = c2d(G,Ts,'zoh');
%% PT1 trasient response
x0 = 0;
x = lsim(H,u,[],x0,'zoh');
%% PT1 freq. response
[h,~] = freqz(H.Numerator{1:end},H.Denominator{1:end},f,fs);
%% Plot
figure(1),clf(1),hold on
plot(u),plot(x),plot(abs(h))

採用された回答

MOC
MOC 2020 年 6 月 11 日
Found the error by myself now.
I did not use the instantaneous frequency for the calculation of the sweep signal, as stated here or here.
The corrected code is:
clear
%% Input (linear frequency sweep)
Ts = .1e-3;
duration = 30;
t = (0:Ts:duration);
fs = 1/Ts;
f = (fs/2)*t/duration;
finst = 1/2*(fs/2)/duration*t;
u = sin(2*pi*finst.*t);
%% PT1-system continuous
T1 = 1e-3;
G = tf(1,[T1 1]);
%% PT1 discretized
H = c2d(G,Ts,'zoh');
x0 = 0;
%% PT1 trasient response
x = lsim(H,u,[],x0,'zoh');
%% PT1 freq. response
[h,~] = freqz(H.Numerator{1:end},H.Denominator{1:end},f,fs);
%% Plot
figure(1),clf(1),hold on
plot(u),plot(x),plot(abs(h))

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatched Filter and Ambiguity Function についてさらに検索

製品


リリース

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by