Frequency response of discrete PT1

25 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Matched 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