% CASOVNI POTEK PRI RESONANCI set(gca,'LineWidth',2) for ii=1:0.1:6; f=10^ii; om=(2*pi*f); T=1/f; U=1; R=1e2; L=10e-3; C=0.1e-6; Z=R+j*(om*L-1/(om*C)); % Zaporedna vezava RLC I=U./Z; Im=abs(I); fi=angle(Z); t=0:T/100:3*T; u=U*cos(om*t); i=Im*cos(om*t-fi); uL=om*L*Im*cos(om*t-fi+pi/2); uR=R*i; uC=Im*cos(om*t-fi-pi/2)/(om*C); %plotyy(t,u,t,i) subplot(2,1,1); plot(t,u,'-k',t,100*i,'--b') %subplot(2,1,1); plot(t,u,'-k',t,100*i,'--b',t,uL,':r',t,uC,':g',t,uR,':k') axis([0 3*T -U U]) ylabel('Napetost in tok') xlabel('Cas /s') title(['frekvenca = ',num2str(f)]); legend('napetost','tok') p=u.*i; pR=i.^2*R; pL=i.*uL; pC=i.*uC; wC=0.5*C*uC.^2; wL=0.5*L*i.^2 %P=0.5*U*Im*cos(fi)*(1-cos(2*om*t)); %Q=0.5*U*Im*sin(fi)*(-sin(2*om*t)); subplot(2,1,2); plot(t,p,'-k',t,pR,'--b',t,pL,':r',t,pC,':g',t,wC) %axis([0 3*T -1 1]) ylabel('Moc'); legend('p','pR','pL','pC'); xlabel('Cas /s') %hold on %plot([0 3*T], [0 0],'Color','k') %axis off k = waitforbuttonpress; hold off end %plot(x,-1.5*sin(2.*x),'k','LineWidth',3)