blob: ac7fa06d3a3611f262b0d0bb8093fe0bfcdf6157 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
// To find the frequency in the RLC Circuit at a phase angle of 45 degrees
clc;
clear;
R=100;
L=2;
C=20*(10^-6);
f1=poly([0 1],'f1','c');
f2=poly([0 1],'f2','c');
w1=2*%pi*f1;
w2=2*%pi*f2;
//To achieve a phase angle of 45 degrees, the difference between Xl and Xc should be equal to R
// We have two different situations
Xl1=L*w1;
Xc1=1/(w1*C);
Xl2=L*w2;
Xc2=1/(w2*C);
cs1=Xl1-Xc1-R;
cs2=Xc2-Xl2-R;
f1=roots(cs1(2));
f2=roots(cs2(2));
//To find the suitable roots and to differenciate between positive and negative roots.
a=sqrt(f1(1));
b=sqrt(f1(2));
c=sqrt(f2(1));
d=sqrt(f2(2));
if(imag(a))
f1=f1(2);
end
if(imag(b))
f1=f1(1);
end
if(imag(c))
f2=f2(2);
end
if(imag(d))
f2=f2(1);
end
disp('The frequencies at which the phase angle is 45 degress are')
disp('Hz',f2,'f2 =','Hz',f1,'f1 =')
|