フィルターのクリア

How to add a time delay to a diagonal ss from a reside pole function?

30 ビュー (過去 30 日間)
Joan
Joan 2024 年 7 月 3 日 17:28
編集済み: Joan 2024 年 7 月 4 日 5:53
Hi,
I have a list of poles (Ak) and residues(Ck) and one delay (tau) that corresponds to the following function:
I have created a ss representation of the rational function and also calculate the function analytically.
I have compared both functions using a bodeplot and they do not match when the time delay is present but match without it.
Can someone help me to find out how to add the time delay correctly?
% Delay problem
Ak = [-0.0633296088793117 + 0.00000000000000i
-0.188476918974608 + 0.00000000000000i
-0.592850411790702 + 0.00000000000000i];
Ck = [2.67546115276169e-05 + 0.00000000000000i
0.000235105989428637 + 0.00000000000000i
0.00132009482602487 + 0.00000000000000i];
D = 0;
tau = 0.001013802649678;
% Express as diagona form
F_A = eye(size(Ak,1),size(Ak,1)).*Ak;
F_B = ones(size(Ak));
F_C = Ck.';
F_D = D;
Fss = ss(F_A,F_B,F_C,F_D,'OutputDelay',tau);
% Analytic function
freq = logspace(-3,6,1000);
w = 2*pi*freq;
f = D;
for i = 1:length(Ak)
f = f + Ck(i)./(1j*w - Ak(i));
end
f = f.* exp(-1j*w.*tau);
Fana = frd(f,w);
% Comparison bode plot
opts = bodeoptions;
opts.FreqUnits = 'Hz';
opts.FreqScale = 'Log';
opts.MagUnits = 'abs';
opts.MagScale = 'Linear';
opts.grid = 'on';
figure, bodeplot(Fss,Fana,w,opts)
title("Bode plot of H")
legend('SS model', 'Analitic')
Thanks and BR,
//JH

採用された回答

Paul
Paul 2024 年 7 月 3 日 23:37
編集済み: Paul 2024 年 7 月 3 日 23:46
Hi Joan,
The problem appears to be with how bodeplot is unwrapping the phase.
Here is the original code
% Delay problem
Ak = [-0.0633296088793117 + 0.00000000000000i
-0.188476918974608 + 0.00000000000000i
-0.592850411790702 + 0.00000000000000i];
Ck = [2.67546115276169e-05 + 0.00000000000000i
0.000235105989428637 + 0.00000000000000i
0.00132009482602487 + 0.00000000000000i];
D = 0;
tau = 0.001013802649678;
% Express as diagona form
F_A = eye(size(Ak,1),size(Ak,1)).*Ak;
F_B = ones(size(Ak));
F_C = Ck.';
F_D = D;
Fss = ss(F_A,F_B,F_C,F_D,'OutputDelay',tau);
% Analytic function
freq = logspace(-3,6,1000);
w = 2*pi*freq;
f = D;
for i = 1:length(Ak)
f = f + Ck(i)./(1j*w - Ak(i));
end
f = f.* exp(-1j*w.*tau);
Fana = frd(f,w);
% Comparison bode plot
opts = bodeoptions;
opts.FreqUnits = 'Hz';
opts.FreqScale = 'Log';
opts.MagUnits = 'abs';
opts.MagScale = 'Linear';
opts.grid = 'on';
figure, bodeplot(Fss,Fana,w,opts)
title("Bode plot of H")
legend('SS model', 'Analitic')
Zoom in on the end of the plot where things are different
xlim([1e4 1e6])
Now repeat the plot, but keep -180 <= phase <= 180
opts.PhaseWrapping = 'on';
figure, bodeplot(Fss,Fana,w,opts)
title("Bode plot of H")
legend('SS model', 'Analitic')
xlim([1e4 1e6])
Now both plots match.
I'm not sure why the phase unwrapping is a problem for Fana but not for Fss.
  1 件のコメント
Joan
Joan 2024 年 7 月 4 日 5:53
編集済み: Joan 2024 年 7 月 4 日 5:53
Thanks Paul. It seems the analyitic function phase gets wrapped when performing the operation exp(-1j*w.*tau).
I have tried the code and it works.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangePlot Customization についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by