Fourier SeriesIf π₯(π‘) is a periodic function with period T, then the continuous-time Fourier series of the function is defined as, $$\mathrm{x(t)=\sum_{n=-\infty}^{\infty}C_ne^{jn\omega_{0}t}\:\:\:\:\:.....(1)}$$Where, πΆπ is the exponential Fourier series coefficient, that is given by$$\mathrm{C_n=\frac{1}{T}\int_{t_0}^{t_0+T}x(t)e^{-jn\omega_0t}dt\:\:\:\:\:.....(2)}$$Convolution Property of Fourier SeriesAccording to the convolution property, the Fourier series of the convolution of two functions π₯1(π‘) and π₯2(π‘) in time domain is equal to the multiplication of their Fourier series coefficients in frequency domain.If π₯1(π‘) and π₯2(π‘) are two periodic functions with time period T and with Fourier series coefficients πΆπ and π·π. Then, if$$\mathrm{x_1(t)\overset{FS}{\leftrightarrow}C_n}$$$$\mathrm{x_2(t)\overset{FS}{\leftrightarrow}D_n}$$Then, the convolution property of continuous time Fourier series states that$$\mathrm{x_1(t)*x_2(t)\overset{FS}{\leftrightarrow}TC_nD_n}$$ProofBy ... Read More
Fourier SeriesConsider a periodic signal π(π‘) be periodic with period T, then the Fourier series of the function π(π‘) is defined as, $$\mathrm{g(t)=\sum_{n=-\infty}^{\infty}C_{n}e^{jn\omega_{0}t}\:\:\:\:....(1)}$$Where, πΆπ is the Fourier series coefficient and is given by, $$\mathrm{C_{n}=\frac{1}{T}\int_{\frac{-T}{2}}^{\frac{T}{2}}g(t)e^{-jn\omega_{0}t}dt\:\:\:\:....(2)}$$Derivation of Fourier Transform from Fourier SeriesLet π₯(π‘) be a non-periodic signal and let the relation between π₯(π‘) and π(π‘) is given by, $$\mathrm{X(t)=\lim_{T\rightarrow \infty}g(t)\:\:\:\:.....(3)}$$Where, T is the time period of the periodic signal π(π‘).By rearranging eq. (2), we get, $$\mathrm{TC_n=\int_{\frac{-T}{2}}^{\frac{T}{2}}g(t)e^{-jn\omega_{0}t}dt}$$The term πΆπ represents the magnitude of the component of frequency nΟ0.Let nΟ0 = Ο at π β β. Then, we have, $$\mathrm{\omega_0=\frac{2\pi}{t}|_{T\rightarrow \infty}\rightarrow 0}$$Thus, the discrete ... Read More
The graph plotted between the Fourier coefficients of a periodic function $x(t)$ and the frequency (Ο) is known as the Fourier spectrum of a periodic signal.The Fourier spectrum of a periodic function has two parts βAmplitude Spectrum β The amplitude spectrum of the periodic signal is defined as the plot of amplitude of Fourier coefficients versus frequency.Phase Spectrum β β The plot of the phase of Fourier coefficients versus frequency is called the phase spectrum of the signal.The amplitude spectrum and phase spectrum together are known as Fourier frequency spectra of the periodic signal $x(t)$. This type of representation of ... Read More
A periodic signal can be represented over a certain interval of time in terms of the linear combination of orthogonal functions, if these orthogonal functions are trigonometric functions, then the Fourier series representation is known as trigonometric Fourier series.ExplanationConsider a sinusoidal signal $x(t)=A\:sin\:\omega_{0}t$ which is periodic with time period $T$ such that $T=2\pi/ \omega_{0}$. If the frequencies of two sinusoids are integral multiples of a fundamental frequency $(\omega_{0})$, then the sum of these two sinusoids is also periodic.We can prove that a signal $x(t)$ that is a sum of sine and cosine functions whose frequencies are integral multiples of the ... Read More
To check if an object is a tensor or not, we can use the torch.is_tensor() method. It returns True if the input is a tensor; False otherwise.Syntaxtorch.is_tensor(input)Parametersinput β The object to be checked, if it is a tensor or not .OutputIt returns True if the input is a tensor; else False.StepsImport the required library. The required library is torch.Define a tensor or other object.Check if the created object is a tensor or not using torch.is_tensor(input).Display the result.Example 1# import the required library import torch # create an object x x = torch.rand(4) print(x) # check if the above ... Read More
Fourier SeriesIf $x(t)$ is a periodic function with period $T$, then the continuous-time exponential Fourier series of the function is defined as, $$\mathrm{x(t)=\sum_{n=β\infty}^{\infty}C_{n}e^{jn\omega_{0} t}β¦ (1)}$$Where, $C_{n}$ is the exponential Fourier series coefficient, which is given by, $$\mathrm{C_{n}=\frac{1}{T}\int_{t_{0}}^{t_{0}+T}x(t)e^{-jn\omega_{0} t}dtβ¦ (2)}$$Time Shifting Property of Fourier SeriesLet $x(t)$ is a periodic function with time period $T$ and with Fourier series coefficient $C_{n}$. Then, if$$\mathrm{x(t)\overset{FS}{\leftrightarrow}C_{n}}$$Then, the time shifting property of continuous-time Fourier series states that$$\mathrm{x(t-t_{0})\overset{FS}{\leftrightarrow}e^{-jn\omega_{0} t_{0}}C_{n}}$$ProofFrom the definition of continuous-time Fourier series, we get, $$\mathrm{x(t)=\sum_{n=β\infty}^{\infty}C_{n}e^{jn\omega_{0} t}β¦(3)}$$Replacing $t$ by $(tβ t_{0})$ in equation (3), we have, $$\mathrm{x(tβ t_{0})=\sum_{n=β\infty}^{\infty}C_{n}e^{jn\omega_{0}(tβ t_{0})}}$$$$\mathrm{\Rightarrow\:x(tβ t_{0})=\sum_{n=β\infty}^{\infty}(C_{n}e^{-jn\omega_{0}t_{0}})e^{jn\omega_{0}t}β¦ (4)}$$$$\mathrm{β΅\:\sum_{n=β\infty}^{\infty}(C_{n}e^{-jn\omega_{0}t_{0}})e^{jn\omega_{0}t}=FS^{-1}[C_{n}e^{-jn\omega_{0}t_{0}}]β¦ (5)}$$From equations (4) & ... Read More
Fourier TransformThe Fourier transform of a continuous-time function $x(t)$ can be defined as, $$\mathrm{X(\omega)=\int_{β\infty}^{\infty}x(t)e^{-j\omega t}dt}$$And the inverse Fourier transform is defined as, $$\mathrm{x(t)=\frac{1}{2\pi}\int_{β\infty}^{\infty}X(\omega)e^{j\omega t}d \omega}$$Time Differentiation Property of Fourier TransformStatement β The time differentiation property of Fourier transform states that the differentiation of a function in time domain is equivalent to the multiplication of its Fourier transform by a factor $j\omega$ in frequency domain. Therefore, if$$\mathrm{x(t)\overset{FT}{\leftrightarrow}X(\omega)}$$Then, according to the time differentiation property, $$\mathrm{\frac{d}{dt}x(t)\overset{FT}{\leftrightarrow}j\omega\cdot X(\omega)}$$ProofFrom the definition of inverse Fourier transform, we have, $$\mathrm{x(t)=\frac{1}{2\pi}\int_{β\infty}^{\infty}X(\omega)e^{j\omega t} d\omega}$$Taking time differentiation on both sides, we get, $$\mathrm{\frac{d}{dt}x(t)=\frac{d}{dt}\left [ \frac{1}{2\pi} \int_{β\infty}^{\infty}X(\omega)e^{j\omega t} d\omega\right ]}$$$$\mathrm{\Rightarrow\:\frac{d}{dt}x(t)=\frac{1}{2\pi}\int_{β\infty}^{\infty}X(\omega)\frac{d}{dt}[e^{j\omega t}]d\omega=\frac{1}{2\pi}\int_{β\infty}^{\infty}X(\omega)j\omega ... Read More
The use of "with torch.no_grad()" is like a loop where every tensor inside the loop will have requires_grad set to False. It means any tensor with gradient currently attached with the current computational graph is now detached from the current graph. We no longer be able to compute the gradients with respect to this tensor.A tensor is detached from the current graph until it is within the loop. As soon as it is out of the loop, it is again attached to the current graph if the tensor was defined with gradient.Let's take a couple of examples for a better ... Read More
The backward() method is used to compute the gradient during the backward pass in a neural network.The gradients are computed when this method is executed.These gradients are stored in the respective variables.The gradients are computed with respect to these variables, and the gradients are accessed using .grad.If we do not call the backward() method for computing the gradient, the gradients are not computed.And, if we access the gradients using .grad, the result is None.Let's have a couple of examples to demonstrate how it works.Example 1In this example, we attempt to access the gradients without calling the backward() method. We notice ... Read More
Fourier SeriesIf $x(t)$ is a periodic function with period $T$, then the continuous-time exponential Fourier series of the function is defined as, $$\mathrm{x(t)=\sum_{n=β\infty}^{\infty}C_{n}\:e^{jn\omega_{0} t}β¦ (1)}$$Where, $C_{n}$ is the exponential Fourier series coefficient, which is given by, $$\mathrm{C_{n}=\frac{1}{T}\int_{t_{0}}^{t_{0}+T}x(t)e^{-jn\omega_{0} t}dtβ¦ (2)}$$Time Differentiation Property of Fourier SeriesIf $x(t)$ is a periodic function with time period T and with Fourier series coefficient $C_{n}$. If$$\mathrm{x(t)\overset{FS}{\leftrightarrow}C_{n}}$$Then, the time differentiation property of continuous-time Fourier series states that$$\mathrm{\frac{dx(t)}{dt}\overset{FS}{\leftrightarrow}jn\omega_{0}C_{n}}$$ProofBy the definition of continuous time Fourier series, we get, $$\mathrm{x(t)=\sum_{n=β\infty}^{\infty}C_{n}e^{jn\omega_{0} t}β¦ (3)}$$By taking time differentiation on both sides of the equation (3), we have, $$\mathrm{\frac{dx(t)}{dt}=\sum_{n=β\infty}^{\infty}C_{n}\frac{d(e^{jn\omega_{0} t})}{dt}}$$$$\mathrm{\Rightarrow\:\frac{dx(t)}{dt}=\sum_{n=β\infty}^{\infty}C_{n}e^{jn\omega_{0} t}(jn\omega_{0})}$$$$\mathrm{\Rightarrow\:\frac{dx(t)}{dt}=\sum_{n=β\infty}^{\infty}(jn\omega_{0}C_{n})e^{jn\omega_{0} t}β¦ (4)}$$$$\mathrm{β΅\: \sum_{n=β\infty}^{\infty}(jn\omega_{0}C_{n})e^{jn\omega_{0}t}=FS^{-1}[jn\omega_{0}C_{n}]β¦ ... Read More