## Plotting script for Matlab/Octave

Download script

Incorporates region of convergence and unit circle into 3D plot and also plots 2D zplane and frequency response (through regular Matlab/Octave functions zplane and freqz). Heavily commented so have a look around the code.

Set transfer function numerator and denominator coefficients at the top of the script. (Just edit the script directly)

\[X(z)=\frac{2+z^{-1}}{1-z^{-1}-2z^{-2}}\]

Enter

```
b = [2 1 0];
a = [1 -1 -1];
causal = true;
```

Set causal to false for ROC inside circle instead of outside.

Or easier to set poles as factors

\[X(z)=\frac{(z+0.5)}{(z+2)(z-1)}\]

Enter:

```
b = [1 0.5];
a1 = [1 2];
a2 = [1 -1];
a = conv(a1, a2);
causal = true;
```

## Some examples

### Simple example

```
b = [1 0];
a = [1 -1];
causal = true;
```

View large image

### First example above

```
b = [2 1 0];
a = [1 -1 -1];
causal = true;
```

View large image

### Factors example above

```
b = [1 0.5];
a1 = [1 2];
a2 = [1 -1];
a = conv(a1, a2);
causal = true;
```

View large image

### Complex numbers example

```
b = [1 (1+j)];
a1 = [1 2];
a2 = [1 -0.75];
a = conv(a1, a2);
causal = false;
```

View large image