You are on page 1of 9

# Harmonic_Order 500 :=

Fs 100 :=
NN 13 := N 2
NN
:= i 0 1 , N 1 ( ) .. :=
i
2

N
i Fs ( ) :=
k 0 1 , 100 .. :=
Modulation 1 :=
X
i
sin
i
( )
:= Carrier
i
2

asin X
i
( )
:=
R1
i
Modulation sin
1
Fs

i

\
|
|

:= Y1
i
Modulation sin
1
Fs

i
2

3

|

\
|
|

:= B1
i
Modulation sin
1
Fs

i

\
:=
Minimum
i
Out1
i
R1
i
R1
i
Y1
i
<
( )
R1
i
B1
i
<
( )
if
Out1
i
Y1
i
Y1
i
R1
i
<
( )
Y1
i
B1
i
<
( )
if
Out1
i
B1
i
otherwise
Out1
i
:=
Maximum
i
Out1
i
R1
i
R1
i
Y1
i
>
( )
R1
i
B1
i
>
( )
if
Out1
i
Y1
i
Y1
i
R1
i
>
( )
Y1
i
B1
i
>
( )
if
Out1
i
B1
i
otherwise
Out1
i
:=
R
i
R1
i
Maximum
i
Minimum
i
+
( )
2

2
3
:=
( )
Y
i
Y1
i
Maximum
i
Minimum
i
+
( )
2

2
3
:=
B
i
B1
i
Maximum
i
Minimum
i
+
( )
2

2
3
:=
RPhase
i
1
2
R
i
Carrier
i
> if
1
2
otherwise
:=
YPhase
i
1
2
Y
i
Carrier
i
> if
1
2
otherwise
:=
BPhase
i
1
2
B
i
Carrier
i
> if
1
2
otherwise
:=
0 200 400 600
2
1
0
1
2
Carrier
i
R
i
Y
i
B
i

i
0 50
0.5
0
0.5
RPhase
i
YPhase
i
BPhase
i

i
VRY
i
RPhase
i
YPhase
i
:=
VYB
i
YPhase
i
BPhase
i
:=
VBR
i
BPhase
i
RPhase
i
:=
p 0 1 , Harmonic_Order .. :=
A
p
1
N
0
N 1 ( )
i
VRY
i
cos 2 p
i
N

\
|
|

\
|
|

=
:=
B
p
1
N
0
N 1 ( )
i
VRY
i
sin 2 p
i
N

\
|
|

\
|
|

=
:=
C
p
A
p
( )
2
B
p
( )
2
+ :=
Phase
p
atan2 A
p
B
p
,
( )
180

:=
190 200
0
0.1
0.2
C
p
p
0 100 200 300
200
100
0
100
200
Phase
p
p
Voltage THD
THD
2
Harmonic_Order
p
C
p
( )
2

=
C
1
( )
2
:=
THD 0.459 =
Current_THD
2
Harmonic_Order
p
C
p
( )
2
p
2

=
C
1
( )
2
:=
Current_THD 3.933 10
3
=
i
2

3
+
|
|

RYB
i
Maximum
i
Minimum
i
+
( )
2
:=
800
100
400 500