RF-Toolbox: timeresp with time delay although delay is zero

14 次查看(过去 30 天)
I am using the function timeresp of the RF-Toolbox in a loop with 500 iterations. I observed that the signal is delayed every loop by one index which is equal to a delay of 1 ts. I checked the input and the delay of the rationalfit transfer function is 0. This is because although delay is set to 0, y(1) is set to 0:
y(1:delaynum) = 0;
Input Output 1. loop Output 2. loop
9999.99595344380 0 0
9999.99595344820 299.634476573046 0
9999.99595345260 478.100830944963 8.97808558815310
To avoid this, I changed the code and removed this section.
But the signal is still delayed, because D is 0 in my case and X(1) is 0 by definition, the first time step of the response y(1) will always be 0. So I got the same output as before. Then I changed the code again, so that I shifted the response signal y_new(1)=y_old(2) … y_new(end-1)=y_old(end) and y_new(end)=y_old(end). I still encounter the problem of a delayed signal.
y(1:end-1,1)=yold(2:end,1);
y(end,1)=yold(end,1);
Input Output 1. loop Output 2. loop Output 10. loop
9999.99595319807 299.634476565683 8.97808558793248 1.94682740271114e-10
9999.99595320246 478.100830933214 19.6730244510586 1.23828384323514e-09
9999.99595320678 856.857068263674 45.5557442730978 5.93943329969475e-09
I do not expect a delay caused by my used rationalfit transfer function. I would only expect a lower rise time of my signal after 500 iteration. The Output of the 10. loop is greater than 1 after 62 time steps and greater than 1000 after 195 time steps with an input of 10 000. This still looks like a delay. This does not seem reasonable to me.
How can I overcome this problem that my undelayed signal is delayed?
Thank you in advance for your help.
Kind regards
Lukas
%%https://de.mathworks.com/help/rf/ug/timeresp.html
%%[...]
%%Check the property TF
checkproperty(h);
%%Get the property
poles = h.A;
c = h.C;
d = h.D;
delay = h.Delay;
%%Calculate output signal
f = exp(poles*ts);
g = (f - 1)./poles;
x=zeros(length(poles), 1);
n = length(u);
y=zeros(n, 1);
yold=zeros(n, 1); %New
for k=1:n
yold(k) = sum(c.*x) + d*u(k); %d*u(k) will always be 0
x = f.*x + g*u(k);
%X(1)=0 -> X(2)=g*u(k) -> X(3)=f*g*u(k)+g*u(k)
end
y(1:end-1,1)=yold(2:end,1); %New
y(end,1)=yold(end,1); %New
delaynum = 0 ; % round(delay/ts); %Delay is set to 0!
%y(delaynum+1:delaynum+n) = y;
%y(1:delaynum) = 0;
%y = real(y(:));
t = double(0:(delaynum+n-1))'*ts;
end

采纳的回答

Lukas Preiss
Lukas Preiss 2019-5-7
Increasing the temporal resolution does not effect the solution, because the artificial delay is caused by the non linear group delay of the transfer function. What I observed was the self cumulative effect of the dispersion. A work around is to add a threshold. I chose 1/1000 of the input and then the results are fine.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Digital Filter Analysis 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by