EE-2027 Assignment: Simulating and Analysing a 2nd Order Electrical System Dr Martin Brown Start date: Wednesday, 17/11/04 Submission date: Wednesday, 8/12/04 at 4pm to mailboxes, B21 Assignment Description The aim of this assignment is to develop various simulations in Matlab and Simulink of a 2nd order system (an electrical circuit) and compare their properties. In addition, you will use the Fourier transform/inverse transform to calculate the true system’s step response. Consider the circuit shown below which consists of a Resistor, Capacitor and Inductor with values R=2, C=4 and L=0.25, respectively. x(t) is the source voltage and y(t) is the voltage across the capacitor. The system is at rest, y(t)=0, for t<0. R L x(t) y(t) C For this assignment you must: 1. Derive the continuous-time differential system to relate the input source voltage to the output voltage across the capacitor, 2. Implement this system as a continuous time model in Simulink and compare the response of inputting a step of size 10V at time t=1, to imputing a sinusoidal signal of frequency 1 and output between 0 and 10V. In each case, you should make sure the simulation time is long enough so that the output signal settles to a regular, steady state response. For the sinusoidal signal, estimate the amplitude gain and phase margin between the input and output sinusoidal signals. Change the frequency to 10 and re-estimate the amplitude gain and phase margin. 3. Convert the continuous time system to a discrete time system using the Euler-type approximations for a 1st and 2nd order derivative. dy (t ) y (t ) y (t ) dt 2 d y (t ) y (t ) 2 y (t ) y (t ) dt 2 2 You should assume that the sampling time =0.05s. 4. Write a Matlab script/function that simulates the discrete time system by calculating the output vector y[n], when an input vector x[n] is supplied. Verify this work by inputting a step and sinusoid, as described in part 2. In addition, calculate (and store) the discrete time impulse response. 5. Given the discrete time impulse response of a system and a particular input sequence, you should write your own version of the Matlab conv() function which calculates corresponding discrete time response. Test/verify your convolution function with an input signal which is identically zero except for a sequence of five 1’s, and could be represented as x[n] = u[n]-u[n-5]. 6. Use the Fourier transform/inverse transform theory to calculate the system’s step response. This can be used to validate the answer to earlier questions. Marking Scheme This assignment accounts for 20% of the total marks for the course This will be marked according to: 10% for deriving the continuous time and discrete models (1). 20% for writing and performing all the continuous time simulations in Simulink (2). 20% for writing and performing all the discrete time simulations in Matlab (3&4). 20% for writing a discrete time convolution function in Matlab (5). 15% for calculating the system’s impulse response using Fourier transforms/inverse transforms (6). 15% for writing the report in a structured, readable form and handing in a CD containing the executable Matlab scripts/functions and Simulink models. The marks will be split between assessing the Matlab code (the more structured and commented the better), the correctness and the validation of the results and the written explanation in the report. Submission The assignment is due on Wednesday 8/12/04 at 4pm. This should be handed in to 2nd year mailboxes in B21. You should hand in a copy of your report that contains a description of all the work done on the assignment, what results have been found as well as including any Matlab code that has been developed in the appendix. When writing a report you must summarise your findings (figures to summarise lots of numbers). Marks will be deducted if there is lots of data, but few conclusions. In addition, you should hand in a copy of all your data and code (on CD) so that I can easily re-run your experiments in Matlab/Simulink and verify your results. Regulations This assignment should be done in accordance with normal University rules and regulations. In particular, it is stressed that this assignment should be done individually, as per the standard regulations on Plagiarism. Any help/joint work must be explicitly referenced in your reports, and marks will be adjusted accordingly. Plagiarism may result in a mark of 0.