Input Signal from state space model

14 views (last 30 days)
Justin
Justin on 12 Nov 2022
Answered: Sam Chak on 12 Nov 2022
im just wondering how can i plot the input signal of a state space model? and also how do i include a step reference signal for my input channel?
A = [ 0 0 0 1.0000 0 0
0 0 0 0 1.0000 0
0 0 0 0 0 1.0000
0 6.5000 -10.0000 -17.5000 0 0
-21.1185 18.1040 5.1540 -3.6920 -2.8128 0.3159
5.0000 -3.6000 0 0 0 -10.9545];
B =[ 0 0
0 0
0 0
26.5000 11.2000
5.5907 -1.6525
40.0000 57.3000];
C = [1 0 0 0 0 0
0 1 0 0 0 0
0 0 1 0 0 0];
D = 0;

Answers (1)

Sam Chak
Sam Chak on 12 Nov 2022
You can try using the lsim() function. Search Google/Documentation for details. Example is shown below:
A = [ 0 0 0 1.0000 0 0;
0 0 0 0 1.0000 0;
0 0 0 0 0 1.0000;
0 6.5000 -10.0000 -17.5000 0 0;
-21.1185 18.1040 5.1540 -3.6920 -2.8128 0.3159;
5.0000 -3.6000 0 0 0 -10.9545];
B = [ 0 0;
0 0;
0 0;
26.5000 11.2000;
5.5907 -1.6525;
40.0000 57.3000];
C = [1 0 0 0 0 0;
0 1 0 0 0 0;
0 0 1 0 0 0];
D = 0;
sys = ss(A, B, C, D);
Tp = 1; % 1 cycle period
Tf = 1; % final time simulation
Ts = 1e-4; % sample time
[u, t] = gensig('sine', Tp, Tf, Ts);
lsim(sys, [heaviside(t - 0.25), -2*u], t) % 1st input is step, 2nd input is sine

Categories

Find more on Signal Processing Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!