Lab 10: Fourier Series MATLAB
Introduction
Fourier series is a mathematical tool used in the field of signals and systems that enables us to represent complex periodic signals as a sum of simple sine and cosine waves. Essentially, it decomposes any periodic signal into a combination of harmonically related sinusoids, each characterized by a specific amplitude, frequency, and phase. This decomposition is crucial because it simplifies the analysis and processing of signals in various applications like telecommunications, signal processing, and control systems, by transforming them into a frequency domain representation where different frequency components can be studied and manipulated individually. A Fourier series represents a periodic function f(x) as an endless sum of weighted sines and cosines. Given that computers can't process an infinite set of terms, the computer-based execution of the Fourier series serves as an approximation of f(x).
A.1
Amplitude decreases from initial signal, as more signals introduced, the highest most points of the visuals become more curved. This can be seen visually referencing the above figures 1-3 where figure 3 is a combination of figures 1-2.
A.2
As more signals are added, sounds definitely differ. The 3rd iteration is higher than the previous, in fact, the pitch of the sound goes higher than the iteration before it. The last part of the sample code was executed, resulting in a blend of the two sounds that reached a frequency significantly higher than their original frequencies.
Part B: Approximation of a square wave using the Fourier series
B.1
The MATLAB CODE 2 approximates a function using its Fourier series representation. It begins by asking the user for the number of terms, `N_TERMS`, to be used in the approximation. The code then calculates the Fourier coefficients (a_0), (a_n), and (b_n) by integrating over the interval [0, π]. Using a loop, it constructs the Fourier series summation. Finally, it displays the Fourier series approximation on a plot over the range [-10, 10], labeling it appropriately.
B.4
# of terms | Overshoot |
7 | 1.09121 |
20 | 1.08940 |
30 | 1.08414 |
50 | 0.08133 |
Table 1 – Overshoot for different number of terms of the FS
When N is a smaller value, like N = 7, there's a notable increase in error due to the consideration of fewer terms. However, as N rises, reaching values like N=50, the precision improves, and the derived signal aligns more accurately with the reference signal.
B.5
# of terms | Computational time |
7 | 0.0544 |
20 | 0.0912 |
30 | 0.1501 |
50 | 0.2330 |
100 | 34.006 |
Table 2 – Computational time for different number of terms of the FS
Utilizing MATLAB's tic and toc functions, it's evident that while increasing the number of terms enhances the approximation's accuracy, it considerably impacts the computational speed. With just seven terms, the computation finishes in about 57 μs. However, increasing the terms to a hundred extends the computation time to roughly 34 seconds, which is 650 times lengthier. To strike an equilibrium between computational efficiency and accuracy, one could opt for a median number of terms, ensuring neither speed nor precision is overly compromised.
B.6
The balance between precision and computational cost in Fourier series is influenced by multiple factors. Application-specific accuracy demands play a crucial role; for instance, medical imaging requires higher precision than some audio processes. The capabilities of the hardware, particularly processing speed and memory, determine how many terms can be efficiently handled. The efficiency of the algorithm used, the inherent rate at which the function converges to its Fourier representation, and any symmetries in the data can also impact this balance. Additionally, real-time applications impose time constraints, and storage limitations might restrict the number of coefficients stored. Ultimately, striking the right balance hinges on understanding the interplay of application needs, data characteristics, and technological capabilities.
To strike a balance between computational efficiency and accuracy, one might consider using a median number of terms, ensuring that precision isn't sacrificed for the sake of speed.
Part C: Approximation of a triangular wave using the Fourier series
C.1
In the subsequent section of the lab, the provided code is adjusted to depict a triangular, sawtooth wave instead of a square wave. The number of terms, N, was then varied across three distinct executions of the code. The initial run incorporated 10 terms, the second one used 20 terms, and the last one featured 30 terms.
Saw-tooth wave, N_TERMS = 10
Conclusion
The importance of Fourier series in signals and systems cannot be overstated. By breaking down complex signals into their fundamental frequency components, it provides a powerful lens through which we can understand and manipulate signals in a more intuitive and efficient manner. This capability is fundamental to numerous technological applications, from the filtering of unwanted noise in communication signals to the compression of audio and video files for efficient storage and transmission. Moreover, the Fourier series lays the groundwork for the Fourier transform, an extension that applies to non-periodic signals, further broadening its applicability. In essence, the Fourier series is a cornerstone concept in signal processing, offering a universal language for the analysis and synthesis of signals across a multitude of disciplines. This lab was enjoyable as it dealt with MATLAB. This lab was also enjoyable as it introduced a new sense: sound. Attributing different senses to learning materials helps the user understand the curriculum in a more effective manner- hopefully this will continue in lab assignments to come.
Comments
Post a Comment