I have this lab the need to done using Matlab. I want all the files from matlabs please read the instruction.
EGR324L: Linear Systems and Signals Lab Lab 5: Fourier Synthesizer-Simulation using SIMULINK Objective There are two parts in this experiment. The first part is an introductory session, in which you will be introduced to an industry standard simulation program known as SIMULINK and you will learn the basic procedures to simulate a simple dynamic system including a signal generator and a scope. The purpose in the second part is to demonstrate how a periodic waveform can be generated by summing up sinusoids of multiple frequencies. You will use SIMULINK to simulate this waveform synthesis process. PART I: Introduction to SIMULINK Background SIMULINK is a program for simulating signals and dynamic systems. As an extension to MATLAB, SIMULINK adds many features specific to simulation of dynamic systems while retaining all of MATLAB's general purpose functionality. SIMULINK has two phases of use: model definition and model analysis. A typical session starts by either defining a model or recalling a previously defined model, and then proceeds to analysis of that model. To facilitate the model definition, SIMULINK possesses a large class of windows called block diagram windows. In these windows, models are created and edited principally by mouse driven commands. Part of mastering SIMULINK is to become familiar with manipulation of model components in these windows. After you define a model, you can analyze it either by choosing options from the SIMULINK menus or by entering commands in MATLAB's command window. The progress of an ongoing simulation can be viewed while it is running, and the final results can be made available in the MATLAB workspace when the simulation is completed. Procedure 1. Enter the command simulink at the MATLAB prompt to open the main block library. 2. Enter the command blocklib at the MATLAB prompt to open the library for the most commonly used blocks. 3. Click on the SIMULINK or blocklib window, and select New... from the File menu on its menu bar to open a new empty window in which you can construct a system model. The new window is labeled "Untitle"; you can rename it when you save it. 4. Drag the blocks "Signal Gen" and "Scope" into the active window. The angle bracket (>) pointing out of the Signal Generator's block's icon represents its output port, and the angle bracket pointing into the Scope icon represents its input port. 5. After the blocks have been placed, draw a line to connect the block "Signal Gen" to the block "Scope". To connect these two blocks, use the left mouse button to click on either the output or input port of one block, drag to the other block's input or output port to draw a connected line, and then release the left mouse button. 6. Open the Signal Generator block and Scope block by double-clicking on their icons. 7. Pull down the Simulation menu and choose Parameters. Select the text box for Maximum Step Size parameter, change the value to 0.01. 8. Start the simulation by choosing Start from the Simulation menu. 9. Adjust the parameters in the Signal Generator block and Scope block, and observe their effects on the waveform displaying in the scope window. Try several times. 10. Stop the simulation by selecting Stop from Simulation menu. 11. Now save the system to disk as a MATLAB M-file by selecting Save from the File menu. The M-file contains all the commands necessary to describe the model, so that it can be simulated or redrawn on the screen for further editing. Note: lab report is not required for this section. Part II: Fourier Synthesizer Background From Fourier representation theory, a periodic signal f(t) can always be expanded in the trigonometric series: where the period is 2l. Note in particular, that if f(t) is an even function, then bn = 0, and that if f(t) is an odd function, then an = 0. A periodic wave can be simulated by summing the output of several sine wave generators where each generator is generating one harmonic of the periodic wave. The magnitude and phase of each generator must be separately controlled. Such a system model is called a Fourier Synthesizer and will be constructed to simulate several periodic waves in this experiment. The synthesizer generates the fundamental through the nth harmonic with separate magnitude and phase controls on each. The sum of all the harmonics is available as an output. The Sine Wave block in the SIMULINK provides a time varying sinusoids. The amplitude, frequency, and the phase of the signal are determined by the selected parameters. We will use a Sine Wave block as a harmonic generator in the Fourier Synthesizer. Note that the parameters in the Sine Wave block can be set to constants or variables or any valid MATLAB mathematical expression involving constants or variables. Any variables on which a parameter is dependent must be defined in the workspace when a simulation is started, or SIMULINK will signal an error for the block. The Sum block in the SIMULINK adds the value of each input to produce a scalar output. The list of sign parameters may be represented with a constant or a combination of the symbols (+, -) . A combination of pluses and minuses describes the polarity of each individual port, where the number of ports is equal to the number of symbols used. The length of the string is used to determine the number of ports drawn. All the characters other than plus sign are interpreted as the minus signs, including spaces. It is important not to leave spaces between plus and minus signs in the parameter string, or they will cause unwanted negative polarity input ports to appear. This block will serve as a crucial part in the synthesizer superposing all the input harmonics to form the desired periodic waveform. The Scope block in the SIMULINK will be used to display both the input harmonics and the final output waveform. The Power Spectral Density Analyzer Block will be used to analyze the spectrum of the input waveform. Prelab 1. Write the Fourier Series of a square wave with odd symmetry, a peak value of 0.7 volts, an average value of zero and a fundamental frequency of 440 Hz. Write the series in sine form up to the 9th harmonic. Estimate roughly how many harmonics you'll need to add to have a reasonably accurate approximation to the waveform. 2. Write the Fourier series of a triangular wave with even symmetry, a peak value of 1.0 volts, an average value of zero and a fundamental frequency of 440 Hz. Write the series in sine form up to the 9th harmonic. 3. Draw a diagram of the Fourier Synthesizer using the blocks available in SIMULINK, i.e,. Sine Wave, Sum, and Scope, where the Scope block is used for displaying the synthesized periodic wave. Procedure 1. Use SIMULINK blocks, i.e. Sine Wave, Sum, Scope, and Averaging Spectrum analyzer, to construct a Fourier Synthesizer model for the periodic square wave in Prelab 1; start with contains two inputs: one is the fundamental, and the other is the 1st harmonic. Based on your calculations in the Prelab 1, set the magnitude, phase, and frequency for these two inputs to the synthesizer, i.e., set the parameters in the Sine blocks which are used to generate the input signals of the synthesizer. Before you add these inputs to the synthesizer, observe the signal on the Scope. Make sure that the display is consistent with the parameters you set. Start the simulation and observe the output waveform in the scope window and its spectrum in the window of Averaging Spectrum analyzer. Note: the path for the Averaging Spectrum analyzer Block is as follows: blocklib→Simulink→Extras→Filters→DEMO. 2. Add 2nd, 3rd ... and 9th harmonics to the system, one at each time. To do this, you first need to add a "+" in the parameter field of the Sum block, then insert another Sine Wave generator into the system; of course, you need to set the proper parameters for the Sine Wave, based on your prelab calculation. Again, you need to observe the individual harmonics using Scope. Observe the change of the output waveform in the Scope window when the high order harmonics are added to the system. Generate a square wave with the specification in Prelab 1, directively from the Wave Generator Block. Compare your simulated result with this square wave by superposing the two waveforms. Are they consistent? Can you find out how many harmonics you need to add to achieve this accuracy? Is your discovery consistent with your estimate in the Prelab? Is it consistent with the spectrum you observed? 3. Print the simulated square wave for your report. Do not measure the period of the simulated wave, just assume that it is the same as the square wave in the prelab. 4. Save this working model to disk as a MATLAB M-file. The model will be useful for later experiments. 5. Change the phase and magnitude of each harmonic and note that as far as wave shape is concerned the phase of a harmonic is much more important than the magnitude. Try this step for a few times, print out a waveform which can support your conclusion based on your observation. 6. If you have a periodic wave and all of the even harmonics are removed, then the Fourier Series of the resulting wave will have only odd harmonics and will have half-wave odd symmetry. Sketch the output wave from (6) and then on the same axes with the same scales sketch what you would guess t he output would look like if the even harmonics were removed. Remove the even harmonics and observe the output. 7. Repeat above steps for the triangular wave in Prelab 2. Report Turn in the SIMULINK models and all graphical plots. Discuss the results of your experiment, and the questions and confusions you have experienced about this experiment.