Transfer function response using idinput as input signal.

11 ビュー (過去 30 日間)
Rohan Gulur
Rohan Gulur 2023 年 7 月 28 日
コメント済み: Star Strider 2023 年 7 月 28 日
Hello, I currently have a binary(0, 1 alternating) input signal which I created using the idinput signal object. In addition, I also have a discretized transfer function which I have created.
Here is an example of my input signal function: u = idinput(100,'prbs',Band,Range);
My discretized transfer function is a normal discrete transfer function.
I want to plot the time domain response of this idinput signal with a system response using the discretized transfer function. I tried to use the lsim command with the following arguments(transferFunction, u, time).
I am getting an error when plotting the output however, stating that: Incorrect number or types of inputs or outputs for function 'iosize'.
Does anybody know how to properly plot the discretized transfer function response with an idinput signal object.
Regards.
  1 件のコメント
Jon
Jon 2023 年 7 月 28 日
Please provide a simple, standalone, runnable example that reproduces the problem, or at least copy your code, and the full error message. To include code, please use the insert code tool on the MATLAB answers toolbar.

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

採用された回答

Star Strider
Star Strider 2023 年 7 月 28 日
It would help to have the details.
Example —
num = rand(1,2)
num = 1×2
0.1917 0.8408
den = rand(1,3)
den = 1×3
0.7949 0.8426 0.3287
Ts = 0.01;
sys = tf(num,den,Ts)
sys = 0.1917 z + 0.8408 ------------------------------ 0.7949 z^2 + 0.8426 z + 0.3287 Sample time: 0.01 seconds Discrete-time transfer function.
Range = [-2,2];
Band = [0 1/4];
u = idinput(100, 'prbs', Band, Range);
Warning: The PRBS signal delivered is the 100 first values of a full sequence of length 124.
[y,t] = lsim(sys, u);
figure
plot(t, y, 'DisplayName','Output')
hold on
plot(t, u, 'DisplayName','Input')
hold off
grid
legend('Location','best')
This works.
.
  2 件のコメント
Rohan Gulur
Rohan Gulur 2023 年 7 月 28 日
Star Strider - This is exactly what I was looking for! Thank you.
Star Strider
Star Strider 2023 年 7 月 28 日
As always, my pleasure!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMeasurements and Feature Extraction についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by