# MATLAB Filtering Signals?

1. Oct 7, 2012

### XcKyle93

1. The problem statement, all variables and given/known data

Consider the system defined by Y(s) = H(s)X(s) with H(s) = K $\frac{s-a}{(s-b)(s-c)}$. Build a function in MATLAB to simulate this system for given values of a,b,c,K and various input signals x(t) (in the time or in s-domain). Include a function to display plots of the time functions x and y and the Bode plot of the transfer function. You can choose b,c so that the system is stable (that is, both b,c are positive).

2. Relevant equations

3. The attempt at a solution
I believe that the question is asking for two different functions. Here's my attempt at the first function:

function simButter(a, b, c, K, x)
syms s
sys = K * (s-a)/((s-b)*(s-c))

dt = 0.01;
t = 0:dt:10; %dt and 10 were arbitrarily picked; what else would I choose?

lsim(sys, x(t), t)

end

For the second function, I have:
function plotXYandTF(x,y)
dt = 0.01;
t = 0:dt:10;

subplot(1, 2, 1);
plot(t, x(t)); hold on;
plot(t, y(t)); hold off;

sys = tf(x,y);
subplot(1,2,2);
bode(sys)

end

Is this even right? I am kind of confused about the way the question is phrased. In general, I know very little about filtering with MATLAB, despite reading alot of the docs on mathworks.