MATLAB: How can use transfer function to find impulse response

impulse responsematlab iffttransfer function

Hello everybody, I need to find time domain impulse response from the transfer function,and my transfer function is H(W)=R2/(R1/(sR1C+1)+R2),modeling as high pass RC filter. Because I want to use convolution(matlab conv) to convolute input signal and RC filter impulse response(H(t)) to obtain output signal.I think I can use ifft to transfer frequency domain to time domain,obtaining its impulse response but I don't know how to do that. Can someone help me?How to use matlab ifft to do it? Best wish have matlab code example. Thank you for your patience

Best Answer

Just do this all analytically. It’s easiest to describe the derivation with the Symbolic Math Toolbox:
syms C R1 R2 s vi vo
i1 = (vi - vo)/(R1 + 1/(s*C)); % First Branch Equation
i2 = vo/R2; % Second Branch Equation
Node1 = i1 + i2 == 0; % Node Equation
vo = solve(Node1, vo);
H = simplify(collect(vo/vi, s), 'steps', 10) % Transfer Function
h = ilaplace(H); % Impulse Response Is The Inverse Laplace Transform Of The Transfer Function
h = simplify(h, 'steps',10)
hf = matlabFunction(h) % Create An Anonymous Function For Evaluation
H =
-(C*R2*s)/(s*(C*R1 - C*R2) + 1)
h =
(R2*exp(-t/(C*(R1 - R2))))/(C*(R1 - R2)^2) - (R2*dirac(t))/(R1 - R2)
hf = @(C,R1,R2,t) -(R2.*dirac(t))./(R1-R2)+(R2.*exp(-t./(C.*(R1-R2))).*1.0./(R1-R2).^2)./C;
So to plot the impulse response, just substitute in the appropriate values of the components and your time vector in the ‘hf’ anonymous function, and plot the results. I leave that to you.
-----------------------------------------------------------------
EDIT — The expression for ‘i1’ has the components in series in this code. It is corrected in the code in my Comment.