Actually, we solved this in your previous Question. The impulse response is the inverse Fourier transform of the transfer function:
syms C R1 R2 s vi vo
i1 = (vi - vo)/R1 + (vi - vo)/(1/(s*C));
i2 = -vo/R2;
Node1 = i1 + i2 == 0;
vo = solve(Node1, vo);
H = simplify(collect(vo/vi, s), 'steps', 10)
h = ilaplace(H);
h = simplify(h, 'steps',10)
hf = matlabFunction(h)
H =
1 - R1/(R1 + R2 + C*R1*R2*s)
h =
dirac(t) - exp(-(t*(R1 + R2))/(C*R1*R2))/(C*R2)
hf = @(C,R1,R2,t) dirac(t)-exp(-(t.*(R1+R2))./(C.*R1.*R2))./(C.*R2)
If you want to plot the impulse response of your filter, substitute in some component values use ezplot:
h = subs(h, {R1,R2,C}, {10000,100,1E-6});
figure(1)
ezplot(h, [0 1E-3])
For the Fourier transform of the square wave, use the Symbolic Math Toolbox to compute the analytic Fourier transform:
syms A T t w
SqWv = A/(2*t);
FSqWv = int(SqWv * exp(1j*w*T), T, -0.5*t, 0.5*t)
FSqWv =
(A*sin((t*w)/2))/(t*w)
Substitute values for ‘A’ and ‘w’ and plot the function from -t to +t for some value of t.
Best Answer