Modelling a RC circuit
57 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 (:
0 comentarios
Respuestas (1)
Rick Rosson
el 23 de Jun. de 2014
The circuit is not time-invariant. Yet you are applying techniques, such as the DFT, that apply only to time-invariant systems.
2 comentarios
Ruben Díaz Granero
el 27 de Abr. de 2021
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!
Ver también
Categorías
Más información sobre Circuits and Systems en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!