MATLAB Answers

## How to obtain statespace having two inputs from transfer function in matlab mfile

Asked by azan

### azan (view profile)

on 5 Dec 2012
Accepted Answer by Azzi Abdelmalek

### Azzi Abdelmalek (view profile)

I am having a transfer function having two zeros and four poles.

`    G(s)=   (as^2+bs+c)/(s^4+ds^3+es^2 )`

I need to convert TF to statespace such that it has two inputs i.e. matrix B has two columns.I know the commands tf2ss but it gives me statespace with one input.

## 2 Answers

### Azzi Abdelmalek (view profile)

Answer by Azzi Abdelmalek

### Azzi Abdelmalek (view profile)

on 5 Dec 2012
Accepted answer

Use tf2ss to find A,B,C,D , change B to add any inputs you want, then rebuilt a newmodel with ss function

```a=1;b=2;c=1;
d=1;e=1;
N=[a b c];
D=[1 d e 0 0];
[A,B,C,D]=tf2ss(N,D)
B=[B [1;0;0;0]]
new_model=ss(A,B,C,D)
```

### Teja Muppirala (view profile)

Answer by Teja Muppirala

### Teja Muppirala (view profile)

on 5 Dec 2012

How about:

```s = tf('s');
G=   (s^2+s+1)/(s^4+s^3+s^2 );
```
```Gss = ss([G G]);
```

Although I don't quite see the point in having two inputs to the same system (you could just add them together and get the same response).

#### Join the 15-year community celebration.

Play games and win prizes!

Learn more

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

### Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

### MATLAB Academy

New to MATLAB?

Learn MATLAB today!