- #1
XcKyle93
- 37
- 0
Homework Statement
Consider the system defined by Y(s) = H(s)X(s) with H(s) = K [itex]\frac{s-a}{(s-b)(s-c)}[/itex]. 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).
Homework Equations
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 a lot of the docs on mathworks.