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

3 views (last 30 days)
Brandon Knutson on 30 Nov 2023
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)
Mathieu NOE on 1 Dec 2023
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

sai charan sampara on 6 Dec 2023
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.

### Categories

Find more on Time and Frequency Domain Analysis in Help Center and File Exchange

R2023b

### Community Treasure Hunt

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

Start Hunting!