phase shift

조회 수: 7 (최근 30일)
Flavia
Flavia 2011년 8월 17일
I need to simulate a parallel RC circuit with R variable. When I plot it, it seems that are no phase between voltage and current and come Warning: Imaginary parts of complex X and/or Y arguments ignored . and when I calcute this phase (phi), there is something. Can someone help me how to plot with this phase delay? Thanks Flavia Here is my code
f=0.1; %Hz
fs=1000;% Abtastfrequenz in Hz
ta=1/fs;
t=0:ta:100;
T=10;
U=100*sqrt(2)*sin(2*pi*f*t); %V
C=-2*pi*f*1e-6*i; %Kapazität in F
R=15e6*(1+exp(-(t/T+log(5/3))))-14e6; % Widerstand in M Ohm
Y=(1./R)+C;
Z=1./Y;
I=U./Z;
plot(t,I/2e-7,'r',t,U,'g');
grid on
hold on
Im=imag(U./I);
Re=real(U./I);
phi=angle(Im./Re);
figure
plot(t,phi*180/pi);
  댓글 수: 1
Walter Roberson
Walter Roberson 2011년 8월 17일
phi = atan2(Im, Re) might perhaps be clearer.
If Z = 1./Y, and I = U ./ Z, then I = U .* Y. Then U ./I would seem to be U . / (U .* Y) which would be 1 ./ Y which would be the same as Z. Would it then not be more direct to take the real and imag parts of Z rather than of U./I ?

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

채택된 답변

Walter Roberson
Walter Roberson 2011년 8월 17일
C incluedes 1e-6*i so C will normally be complex. Y adds C to a calculation, so Y will normally be complex. Z has 1/Y so Z will normally be complex. I has something ./ Z, so I will normally be complex.
You then plot t vs I, so you are plotting a real value against a (usually) complex value. plot() requires that the coordinates to it be real, with the one exception that if you use plot(P) and P is complex, then real(P) will be plotted against imag(P); this exception never applies if you specify the x (or t) coordinate as you do in this plot() call.
  댓글 수: 2
Flavia
Flavia 2011년 8월 17일
thanks for your answer, but do you now how can I plot voltage and current at some time?
The problem when I a take real and imag parts of Z is that a can not see this phase delay between voltage and current.
Walter Roberson
Walter Roberson 2011년 8월 17일
Perhaps you should be using U as your first coordinate instead of t ? U is voltage according to your comments.

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

추가 답변 (1개)

Flavia
Flavia 2011년 8월 18일
I tried it, aber that did not work like i want. I need in the some graphic both curves (current and voltage), but with phase (phi). At the beginning phi is 80 degree, so the both curves should have the amplitude fast in opposite direction and with the time phase(phi) changed. aber this does not appear with plot()

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by