Difference in sample time of discrete model and input

1 次查看(过去 30 天)
I was going through the algorithms on how MATLAB evaluates convolution in CT system. Example code given on MATLAB is
w2 = 62.83^2;
h = tf(w2,[1 2 w2]);
dt = 0.016;
ts = 0:dt:5;
us = (rem(ts,1) >= 0.5);
hd = c2d(h,dt);
lsim(hd,us)
In the above example sample time of input and TF are the same. I have removed ts from lsim because it was making no difference in this case. So in the output I got 313 samples.
w2 = 62.83^2;
h = tf(w2,[1 2 w2]);
dt = 0.016;
ts = 0:0.02:5;
us = (rem(ts,1) >= 0.5);
hd = c2d(h,dt);
lsim(hd,us)
In the above code sample time of input and TF are different. If i put Ts then it gave an error but when I removed it worked fine. So in the output I had 250 samples. Some of the starting samples matched also.
So my question is how the matlab calculates output in 2nd case ??

采纳的回答

Abhishek Kumar
Abhishek Kumar 2020-12-13
Hi Jatin, given the two codes you have used, the continuous time transfer function is same in both the cases, the differnce is in length of number of samples
>> h1
h1 =
3948
----------------
s^2 + 2 s + 3948
Continuous-time transfer function.
>>dt1 = 0.016;
>>ts1 = 0:dt1:5;
>> length(ts1)
ans =
313
>> h2
h2 =
3948
----------------
s^2 + 2 s + 3948
Continuous-time transfer function.
>>dt2 = 0.016;
>>ts2 = 0:0.02:5;
>> length(ts2)
ans =
251
hence, some of the coefficients are similar you can go through the documentation of functions used for better understanding..

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by