Waveforms
Determine the duty ratio $d$ for which the periodic waveform given below will have no third harmonic component. ($T_s=20\,$msec)In [1]:
from IPython.display import Image
Image(filename =r'waveforms_1_fig_1.png', width=320)
Out[1]:
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
d = 0.4 # to be changed by user
n_div = 2000
t = np.linspace(0.0, 2*T, (n_div+1))
dT = d*T
x = np.where((t % T) > dT, 0.0, 1.0)
t_start = T
t_end = 2.0*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 (load current):')
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=2.0*T*1e3)
ax[0].grid(color='#CCCCCC', linestyle='solid', linewidth=0.5)
ax[0].plot(t*1e3, x, color='blue', linewidth=1.0, label="$x$")
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('$x$',fontsize=13)
ax[1].set_xlabel('$N$',fontsize=13)
ax[1].set_ylabel('$xf$',fontsize=13)
bars2 = ax[1].bar(xf, yf, width=0.3, color='green', label="$xf$" , zorder=3)
plt.tight_layout()
plt.show()
fourier coefficients (load current): 0 4.0100E-01 1 6.0608E-01 2 1.8548E-01 3 1.2635E-01 4 1.5074E-01 5 2.0000E-03 6 1.0152E-01 7 5.1830E-02 8 4.8383E-02 9 6.6638E-02 10 2.0000E-03
This notebook was contributed by Prof. Nakul Narayanan K, Govt. Engineering College, Thrissur. He may be contacted at nakul@gectcr.ac.in.
In [ ]: