Bode Plot for a State Space with two inputs, one constant one oscillating between 0 and 15.

12 次查看(过去 30 天)
I need to find a way to calculate the frequecy reponse using a Bode Plot for a system with a constant downward force (gravity) and a on and off or oscillating thrust force of arbiraty value. Any help is appreciated.
clear
m = 1
k = 2
b = 3
g = 9.81
N = 15
A = [0 1 ;
-k/m -b/m]
B = [0;
N]
C = [1 0;
0 1]
D = [0;
0]
N = 10
sys = ss(A,B,C,D)
tf = tf(sys)
bode(tf)
[mag,phase,wout] = bode(tf)
  1 个评论
Mathieu NOE
Mathieu NOE 2023-12-1
hello
your code does already compute the Bode plot (visualisation of transfer from input(s) to output(s) in frequency domain)
what I understand from your request is the forced output to some specific input (gravity = a constant input, thrust force on/off could be step , if oscillating this would be a sine input, etc ...
where is the problem ? for example ,
  • use step to simulate your state space system with a force step input
  • use lsim to simulate your state space system with a force sine input

请先登录,再进行评论。

回答(1 个)

sai charan sampara
sai charan sampara 2023-12-6
Hello Brandon,
I understand that you are trying to create a bode plot of a state space with multiple inputs.
Transfer function is a mathematical function relating the output or response of a system to the input. The transfer function for a MIMO system will be a matrix of transfer functions. There will be a transfer function for every input and output pair or combination. The function “bode” can be used for creating bode plot of any dynamic system. If “sys” is a multi-input, multi-output (MIMO) model, then “bode(sys)” produces an array of Bode plots, each plot showing the frequency response of one I/O pair.
In your case the “sys” variable hence has two state space models and “bode(tf)” gives two sets of bode plots which is expected behaviour. The individual state space models can be obtained by indexing through the “sys” variable. The functions like “lsim” can be used to simulate the system for arbitrary inputs.
You can also refer to the following resources for more information:

类别

Help CenterFile Exchange 中查找有关 Time and Frequency Domain Analysis 的更多信息

产品


版本

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by