0% found this document useful (0 votes)
29 views1 page

Resonance Matlab Script

This document contains code that calculates and plots the impedance and phase of an RLC circuit with given component values (L, C, R) across a range of frequencies. It calculates the resonance frequency, impedance, current, and phase, then plots the current, reactances, and phase on separate figures. Text is added to annotate the plots with key values like the resonance frequency and maximum current.

Uploaded by

Brad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views1 page

Resonance Matlab Script

This document contains code that calculates and plots the impedance and phase of an RLC circuit with given component values (L, C, R) across a range of frequencies. It calculates the resonance frequency, impedance, current, and phase, then plots the current, reactances, and phase on separate figures. Text is added to annotate the plots with key values like the resonance frequency and maximum current.

Uploaded by

Brad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

L = 100e-3;

C = 0.002e-6;
R = 330;
V = 5;

clc;
fr = 1/(2*pi*sqrt(L*C));
f = 100:10:fr*3;
xl = 2*pi*f*L;
xc = 1./(2*pi*f*C);
q = (1/R)*sqrt(L/C);
fr = 1/(2*pi*sqrt(L*C));
z = sqrt((R^2)+ (xl - xc).^2);
i = V./z;
ph = atan((xl-xc)/R);

%====================================================================
figure(1); clf; hold off
plot(f, R*i,'color','blue');
hold on
plot(f,xl.*i,'color','red');
plot(f,xc.*i,'color',[1,0.5,0]);
set(gca,'Color',[1 0.78 0.80]);

%====================================================================
text(3*fr/4,max(xc.*i)+ max(xc.*i)*0.1,['fr = ' num2str(fr)]);
text(3*2*fr/4,max(xc.*i)+ max(xc.*i)*0.1,['i(max) = ' num2str(max(i))]);
text(3*3*fr/4,max(xc.*i)+ max(xc.*i)*0.1,['Q = ' num2str(q)]);

xlim([0 fr*3]);

ylim([0 max(xc.*i)+ max(xc.*i)*0.2]);


xlabel('Frequency (Hz)');
ylabel('Volts');

%===================================================================
figure(2)
plot(f,ph*180/pi,'color','black'); %phase
xlim([0 fr*3]);
set(gca,'Color',[1 0.78 0.80]);

You might also like