フィルターのクリア

How to simulate controller and plant without using simulink

14 ビュー (過去 30 日間)
Windell
Windell 2017 年 8 月 4 日
回答済み: Robert U 2017 年 8 月 11 日
Hello, I have a transfer function and a controller that I would like to simulate using purely matlab. I know that I can use the step() function to simulate the step response, but I would like to generate my own trajectory and input it into my system and not use an integrator such as ode45(). In simulink I can just output the output of my system and the trajectory is plotted. How would I do the same thing in MATLAB code?
The main reason I would like to do this is that I want to feed the output of my system to modify the trajectory at the input, but at a much slower rate than the sample rate of the controller. Im finding it difficult to figuring out how to do this in simulink.

回答 (1 件)

Robert U
Robert U 2017 年 8 月 11 日
Hi Windell:
You can simulate the time response of dynamic systems to arbitrary inputs with lsim ( https://de.mathworks.com/help/control/ref/lsim.html?s_tid=srchtitle ).
Example for a second order lowpass filter:
%%create input signal
fs = 50e3;
time = 0:1/fs:0.2;
signal = chirp(time,100,0.2,1000,'li');
%%create system
system = tf(1,[1/(2*pi*250)^2 2/(2*pi*250) 1]);
%%simulation
[outSignal, time] = lsim(system,signal,time);
%%plot result
plot(time,[signal; outSignal'])
Kind regards,
Robert

カテゴリ

Help Center および File ExchangeGeneral Applications についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by