Skip to main content
留学咨询

辅导案例-CSU11031

By May 15, 2020No Comments

School of Computer Science and Statistics Trinity College Dublin CSU11031 CS1031: Lab#1 In the first lab we will approximate some functions with sum of sine functions following the Fourier series. The functions you want to plot are: 1. The square wave: build a 6 subplot figure to show the time domain, and use respectively 1, 3, 5, 10, 50, 500 frequencies. Each plot should have overlapped the real square function on a different color. Remember to use a step of minimum 0.01 for the x axis. The Fourier series of the square wave is given by 4pi ∗ ∑n k=1,k=odd sin(2pikt) k Notice that the iteration is only done through the odd numbers, do your For loop will need to start from 1 and advance at step of 2, for example ”for i=1:2:50”. The square wave to be plotted in red is given by ’square(2 ∗ pi ∗ x)′. Hint: The following Matlab syntax might be useful. If you want to draw the 6 figures auto- matically using an outer For loop, you can iterate the loop over specific values (say: 1,3,5,10,50,500) in this way: ”for i=[1,3,5,10,50,500] … code inside the loop that uses the variable i with the values in the bracket above… end;” You will find all the required Matlab commands in the Matlab tutorial. The graphs should look like the following: Figure 1: Square wave approximation in time Page 1 of ?? School of Computer Science and Statistics Trinity College Dublin CSU11031 2. Draw the representation in the frequency domain of the square wave approximation in exercise 1). For this you will need to do a stem plot, where each line represents the amplitude of each sine wave on the sum. The plot will show all such amplitueds, in sequence. The graphs should look like the following: Figure 2: Square wave approximation in frequency Page 2 of ??

admin

Author admin

More posts by admin