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

조회 수: 1 (최근 30일)
Joan
Joan 2024년 7월 3일
편집: Joan 2024년 7월 4일
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일
편집: Paul 2024년 7월 3일
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일
편집: Joan 2024년 7월 4일
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 CenterFile Exchange에서 Get Started with Phased Array System Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by