フィルターのクリア

How to adapt code to apply a sine wave input instead

3 ビュー (過去 30 日間)
Luke Marchisin
Luke Marchisin 2023 年 12 月 8 日
回答済み: Sulaymon Eshkabilov 2023 年 12 月 9 日
i am trying to turn the following code from step input into sine wave and dont know where to start. any help would be greatly appreciated.
t = 0:0.01:500;
u = ones(size(t));
u(1:100) = zeros(1,100);
y = eval_system(u, t);
Unrecognized function or variable 'eval_system'.
figure
plot(sin*t, u,'linewidth',2)
hold on
plot(sin*t, y, 'linewidth',2)
grid on

回答 (1 件)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2023 年 12 月 9 日
If undrestood correctly, you are trying to simulate the linear system. It can be attained using lsim(), e.g.:
t = 0:0.01:10;
y=sin(t);
U_SYS = tf(1, [1 2 3]); % The given continuous system
OUT = lsim(U_SYS,y,t);
figure
plot(t, y,'linewidth',2)
hold on
plot(t, OUT, 'linewidth',2)
grid on
legend('Input', 'Response')
xlabel('t, [s]')
ylabel('y(t), Out(t)')

カテゴリ

Help Center および File ExchangeState-Space Control Design and Estimation についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by