How can use transfer function to find impulse response?

29 vues (au cours des 30 derniers jours)
Tim Yeh
Tim Yeh le 20 Fév 2016
Commenté : Tim Yeh le 23 Fév 2016
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

Réponse acceptée

Star Strider
Star Strider le 20 Fév 2016
Modifié(e) : Star Strider le 21 Fév 2016
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.

Plus de réponses (3)

Tim Yeh
Tim Yeh le 21 Fév 2016
Thanks Star Strider. I am so grateful for your help!
But I still have one question about your code.
i1 = (vi - vo)/(R1 + 1/(s*C)); C and R1 are parallel,so its "First Branch Equation" can be writing as i1 = (vi - vo)/(R1/(1+s*R1*C))?
And Node1 = i1 + i2 == 0; can be writing as Node1 = i1 - i2 == 0?
Because i1=12 right?
  1 commentaire
Star Strider
Star Strider le 21 Fév 2016
My pleasure!
It’s been a while since I did circuit analysis, so this was interesting. It was also educational for me, in that I need to pay more attention to what I’m doing. (I apparently do not multi-task well.)
You’re correct. I erroneously set them up in series rather than in parallel. I corrected ‘i1’ here.
‘And Node1 = i1 + i2 == 0; can be writing as Node1 = i1 - i2 == 0?’
The sum of the currents entering and leaving a node have to be equal to zero. It depends on how you set up the arrows
The (corrected) code:
syms C R1 R2 s vi vo
i1 = (vi - vo)/R1 + (vi - vo)/(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 =
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)

Connectez-vous pour commenter.


Tim Yeh
Tim Yeh le 21 Fév 2016
I appreciated your time and effort.
It's a great help for me.
I will follow your code and do my project, thanks a lot.
  1 commentaire
Star Strider
Star Strider le 21 Fév 2016
As always, my pleasure.
I apologise for my earlier error.

Connectez-vous pour commenter.


Tim Yeh
Tim Yeh le 23 Fév 2016
Excuse me,can I use ifft to find discrete impuluse response(like sinc finction)?
We know s=jw=j2*pi*f,so Transfer function :H(i)= R2/(R1/(sR1C+1)+R2) = R2/(R1/(1+(2*pi*f*C*R1*j)+R2))
Fs=100MHz
Scale:-Fs/2:Fs/100:Fs/2, sample(divide) frequency response to 100 points, so each step size is "Fs/100".
And then put this 100 points value to matlab matrix for doing ifft.
This is my code,I don't know how to next and I think its not the correct answer....
Thank you for your patience.
clear;
clc;
close all;
Fs = 100e6;
R1 = 2500;
R2 = 50;
C = 30*1e-12;
H = [];
for i = 1:100
f = -Fs/2+(Fs/100)*i; %f=-Fs/2:Fs/128:Fs/2
x(i) = f;
H(i) = R2/(R1/(1+(2*pi*f*C*R1*j)+R2));
end
Habs=abs(H);
plot(x,Habs);
y=abs(ifft((H)));
  2 commentaires
Star Strider
Star Strider le 23 Fév 2016
That’s actually a new Question and should be a new post.
I would do it with the Symbolic Math Toolbox instead. Use the int function to do the integral, and set the limits at the times and set the amplitude as in the diagram. You will have to define the ‘t’ constant, or use different variables for the lower-case ‘t’ in the diagram and the integration time variable (perhaps ‘T’) in your integration.
Tim Yeh
Tim Yeh le 23 Fév 2016
I am not quite understand what you mean, I think I'm not smart enough. And I post the new one now.
If you have time,can you give me code example?Thanks!

Connectez-vous pour commenter.

Catégories

En savoir plus sur Stability Analysis dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by