Waveforms

The waveform $x(t)$ given below has half-wave symmetry. Determine the ratio $\displaystyle\frac{V_1}{V_2}$ so that $x$ is free from the fifth harmonic component.
In [1]:
from IPython.display import Image
Image(filename =r'waveforms_6_fig_1.png', width=500)
Out[1]:
No description has been provided for this image
In [2]:
import numpy as np
import matplotlib.pyplot as plt 
import gseim_calc as calc
from setsize import set_size

T = 20.0e-3
omg = 2.0*np.pi/T

theta1 = np.pi/4
theta2 = 3.0*theta1
theta3 = np.pi
theta4 = 5.0*theta1
theta5 = 7.0*theta1

V2 = 1.0
k = 0.4 # to be changed by user
V1 = k*V2

n_div = 5000
t = np.linspace(0.0, T, (n_div+1))

l_x = []

for i, t1 in enumerate(t):
    omg_t1 = omg*t1

    if omg_t1 < theta1:
        v1 = V1
    elif omg_t1 < theta2:
        v1 = V1 + V2
    elif omg_t1 < theta3:
        v1 = V1
    elif omg_t1 < theta4:
        v1 = -V1
    elif omg_t1 < theta5:
        v1 = -(V1 + V2)
    else:
        v1 = -V1
    l_x.append(v1)

x = np.array(l_x)

t_start = 0.0
t_end = T

n_fourier = 10

coeff_x, thd_x = calc.fourier_coeff_1C(t, x, t_start, t_end, 1.0e-8, n_fourier)

print('fourier coefficients (x):')
for i, c in enumerate(coeff_x):
    print("  %3d %11.4E"% (i, c))

xf = np.linspace(0, n_fourier, n_fourier+1)
yf = np.array(coeff_x)

fig, ax = plt.subplots(2, sharex=False)
plt.subplots_adjust(wspace=0, hspace=0.0)
grid_color='#CCCCCC'

set_size(6, 4, ax[0])

xf_ticks = np.arange(0.0, (float(n_fourier+1)), 1.0)

ax[0].set_xlim(left=0.0, right=T*1e3)
ax[0].grid(color='#CCCCCC', linestyle='solid', linewidth=0.5)

ax[0].plot(t*1e3, x, color='blue', linewidth=1.0, label="$V_o$")

ax[1].set_xlim(left=-1.0, right=float(n_fourier))
ax[1].set_xticks(xf_ticks)
ax[1].grid(visible=True, which='major', axis='x', color=grid_color, linestyle='-', zorder=0)

ax[0].set_xlabel('$t$ (msec)',fontsize=13)
ax[0].set_ylabel('$V_o$',fontsize=13)

ax[1].set_xlabel('$N$',fontsize=13)
ax[1].set_ylabel('$V_o^{(k)}$',fontsize=13)

bars2 = ax[1].bar(xf, yf, width=0.3, color='red', label="$V_o^{(k)}$" , zorder=3)

plt.tight_layout()
plt.show()
fourier coefficients (x):
    0  8.0000E-05
    1  1.4096E+00
    2  1.6000E-04
    3  1.3034E-01
    4  1.6000E-04
    5  7.8205E-02
    6  1.6000E-04
    7  2.0137E-01
    8  1.6000E-04
    9  1.5662E-01
   10  1.6000E-04
No description has been provided for this image

This notebook was contributed by Prof. Nakul Narayanan K, Govt. Engineering College, Thrissur. He may be contacted at nakul@gectcr.ac.in.

In [ ]: