Modelling a RC circuit

조회 수: 26 (최근 30일)
aviran
aviran 2014년 6월 22일
댓글: Ruben Díaz Granero 2021년 4월 27일
Hi, I'm trying to model a RC circuit with two R's and one C in parallel. R1,R2,C are vectors which change at a function of time.
I'm calculating the total impedance of the system and then applying an AC current I=I_0*sin(w*t).
My goal is to measure the voltage, I've tried working in the time- domain and also in the frequency domain but I'm having trouble calculating the voltag. it is expected that I will get a sine wave with a phase shift from the current signal , but from some reason it not what I'm getting.
Also, I want to plot the two signal , the input current and the output voltage on the same graph as a function of time so I could see the time shift between them, I'm guessing that the problem I have with that is that the imaginary part of V is not plotted in matlab and that is the part that is responsible for the phase shift. Is there a way to get pass that?
Here is the code that I wrote :
Fs=2000000;
f=10000;%[Hz]Current frequency
t=[0:(1/Fs):0.1-(1/Fs)];%[sec] one cardiac cycle
w=2*pi*f;%[rad/sec]
Cm1=linspace(343*10^-12,448*10^-12,100000);
Cm=[Cm1,Cm1(end:-1:1)];%[F] Myocardium capacitance through one cardiac cycle
Gm1=linspace(173*10^-6,226*10^-6,100000);
Gm=[Gm1,Gm1(end:-1:1)];%[S] Myocardium conductivity through one cardiac cycle
Gb1=linspace(810*10^-6,402*10^-6,100000);
Gb=[Gb1,Gb1(end:-1:1)];%[S] Blood conductivity through one cardiac cycle
%Calculating the admittacne
Y=Gb+Gm+1i*w*Cm;
Y_fft=fft(Y);
%Generating the current applied
I_0=15*10^-6;%[A]
I=I_0*sin(w*t);
I_fft=fft(I);
V_fft= I_fft./Y_fft;
v=ifft(V_fft);
plot(t(1:5000),v(1:5000),t(1:5000),I(1:5000));
Thank you so much for you help!
if you think I should rather work with Simulink let me know (:

답변 (1개)

Rick Rosson
Rick Rosson 2014년 6월 23일
The circuit is not time-invariant. Yet you are applying techniques, such as the DFT, that apply only to time-invariant systems.
  댓글 수: 2
aviran
aviran 2014년 6월 23일
You are right. so is there a way to solve a circuit like that? maybe in the time domain?
Ruben Díaz Granero
Ruben Díaz Granero 2021년 4월 27일
Hi! I've a similar problem operating with the FFT but instead of trying to analyze an output singal I want to obtain the impedance. Nevertheless is the same problem. Do you find any solution?
Thanks!

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Spectral Measurements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by