ECE 315 Project #1 S15 Due March 30, 2015 at 3:35 PM Expectations for Fairness on Projects This is an out-of-class assignment and, as such, can be subject to a student taking the path of least resistance and copying someone else's work. Students talking to each other about the project and discussing methods to complete it correctly is fine because I think students can learn from each other. But each student is expected to write his own code to solve his/her own unique project. Simply electronically copying someone else's MATLAB code or typing in the code while copying it from a printout is unacceptable. The purpose of a project like this is that the student learns about solving a problem using a computer. If a person simply copies some else's code he/she learns little or nothing about solving problems with a computer. The student also takes a big risk in assuming that because the code seems to work on one student's project that it will also work on another student's project. Since the student did not write the code, he/she has no way of knowing whether it is really working or not. Copying code is bad for several reasons. 1. It is unfair to students who labored long and hard to write their own code. 2. The student using the copied code doesn't really learn much, if anything. 3. It can skew the grade distribution in a way that does not reward good hard work enough and does reward dishonesty. So if you have worked hard and written your own successful code and a "friend" asks to copy it, ask your "friend" why he/she does not write his/her own code, like you did. What your friend is really implying is something like the following: "I don't want to take the time to write the code myself and would prefer to benefit from your hard work without any effort on my part and, if you are my friend, you will give it to me. You don't want to lose me as a friend do you?" If you are a student who might be inclined to ask a friend to give you his/her completed code, think about the position you are putting your friend in. You are using your friendship to cheat and asking your friend to be an accomplice in cheating. Is that what a real friend would do? Please have the integrity to do your own work. That means you actually type in the MATLAB code yourself without copying someone else's. This is the only way to really learn how to solve engineering problems using computers and software. Your grade may be a little lower. Or it may be higher because you did not use copied code that does not apply correctly to your problem. But either way at least you actually earned it. Project Description Project parameters for individual projects are available at http://web.eecs.utk.edu/~roberts/ECE315/Project1/xxxxx where xxxxx is your last name followed by your first initial. Continuous-Time System Analysis A continuous-time system is described by the differential equation, a1 y′ ( t ) + a0 y ( t ) = b1 x′ ( t ) + b0 x ( t ) , where x is the excitation and y is the response. (The excitation x ( t ) is described in your parameter file and the values of the a’s and b’s are in your parameter file.) Find and graph the excitation x ( t ) , the impulse response h ( t ) , the unit step response h −1 ( t ) and system response to x ( t ) , y ( t ) . Discrete-Time System Analysis A discrete-time system is described by the difference equation, a0 y [ n ] + a1 y [ n − 1] = b0 x [ n ] + b1 x [ n − 1] , where x is the excitation and y is the response. (The excitation x [ n ] is described in your parameter file and the values of the a’s and b’s are in your parameter file.) Find and graph the excitation x [ n ] , the impulse response h [ n ] , the unit sequence response h −1 [ n ] and system response to x [ n ] , y [ n ] . *********************************************************************** Notice that the subscript sequences for the a's and b's are not the same in continuous and discrete time. *********************************************************************** Report Format Continuous-Time System Analysis Graph of the excitation x ( t ) . (Even though this is described in your parameter file, graph it yourself to be sure your computer program correctly describes it.) Graph of the impulse response h ( t ) . Graph of the unit step response h −1 ( t ) . Graph of the response y ( t ) . All these time graphs should cover the time range from t = 0 to the last time point listed for x ( t ) . Discrete-Time System Analysis Graph of the excitation x [ n ] . (Even though this is described in your parameter file, graph it yourself to be sure your computer program correctly describes it.) Graph of the impulse response h [ n ] . Graph of the unit sequence response h −1 [ n ] . Graph of the response y [ n ] . All these time graphs should cover the time range from n = 0 through the last time point listed for x [ n ] . All graphs must be clear and readable, meaning that actual values should be readable from the graph. A poorly scaled or drawn graph is wrong. In the report, the graphs should appear in the sequence given here. No formal report structure is required. Just hand in the graphs. Put your name at the very top (within 1/2 inch of the top edge) of the first page (as illustrated below). You do not have to print your name. You may write it by hand. Just be sure it is legible. Name 0.5 inch Graphs out of order or name not at the top of the first page will result in point deductions. I will be available during office hours to look at project results and indicate whether there might be an error and what that error might be before the projects are due. MATLAB Example Code The following MATLAB code fragments may help you with some of the routine aspects of the project. Graphing a continuous-time signal x ( t ) % Put a time vector in "t" and a signal value vector of the same length in "x" % figure('Position',[20,20,800,800]) ; ptr = plot(t,x,'k') ; set(ptr,'LineWidth',2) ; grid on ; xlabel('\itt','FontName','Times','FontSize',24) ; ylabel('x({\itt})','FontName','Times','FontSize',24) ; set(gca,'FontName','Times','FontSize',18) ; Graphing a discrete-time signal x [ n ] % Put a time vector in "n" and a signal value vector of the same length in "x" % figure('Position',[20,20,800,800]) ; ptr = stem(n,x,'k','filled') ; set(ptr,'LineWidth',2,'MarkerSize',4) ; grid on ; xlabel('\itn','FontName','Times','FontSize',24) ; ylabel('x[{\itn}]','FontName','Times','FontSize',24) ; set(gca,'FontName','Times','FontSize',18) ; Example Report Example 30 20 x(t) 10 0 -10 -20 -30 -2 0 2 4 6 t 8 10 12 14 8 10 12 14 Example 0.4 0.35 0.3 h(t) 0.25 0.2 0.15 0.1 0.05 0 -2 0 2 4 6 t Example 0.7 0.6 h-1(t) 0.5 0.4 0.3 0.2 0.1 0 -2 0 2 4 6 t 8 10 12 14 8 10 12 14 Example 15 10 y(t) 5 0 -5 -10 -15 -2 0 2 4 6 t Example 9 8 7 6 x[n] 5 4 3 2 1 0 0 5 10 15 n 20 25 30 Example 0.8 0.6 h[n] 0.4 0.2 0 -0.2 -0.4 -0.6 0 5 10 15 n 20 25 30 Example 0.2 0.1 h-1[n] 0 -0.1 -0.2 -0.3 -0.4 -0.5 0 5 10 15 n 20 25 30 Example 2 1 0 y[n] -1 -2 -3 -4 -5 0 5 10 15 n 20 25 30 General Solution Continuous-Time a1 y′ ( t ) + a0 y ( t ) = b1 x′ ( t ) + b0 x ( t ) The form of the impulse response is h ( t ) = K h e st u ( t ) + K δ δ ( t ) where s = −a0 / a1 . Kh = Therefore h (t ) = a1b0 − a0b1 b , Kδ = 1 , a1 ≠ 0 2 a1 a1 a1b0 − a0b1 − a0t /a1 b e u ( t ) + 1 δ ( t ) , a1 ≠ 0 . 2 a1 a1 The unit step response is the integral of the impulse response. It is zero for all times t < 0 . For times t > 0 , h −1 ( t ) = ⎡ a1b0 − a0b1 − a0λ /a1 ⎤ b e u ( λ ) + 1 δ ( λ ) ⎥d λ , t > 0 , a1 ≠ 0 2 a1 a1 ⎦ −∞ t ∫ ⎢⎣ ab −a b b h −1 ( t ) = 1 0 2 0 1 ∫ e− a0λ /a1 d λ + 1 , t > 0 , a1 ≠ 0 a1 a1 0 t h −1 ( t ) = a1b0 − a0b1 − a0λ /a1 t b1 a1b0 − a0b1 b ⎡⎣ e ⎤⎦ 0 + = 1− e− a0t /a1 ) + 1 , t > 0 , a0 ≠ 0 , a1 ≠ 0 ( −a0 a1 a1 a0 a1 a1 Therefore, for all time t, ⎡ a b − a0b1 b ⎤ h −1 ( t ) = ⎢ 1 0 1− e− a0t /a1 ) + 1 ⎥ u ( t ) , a0 ≠ 0 , a1 ≠ 0 ( a1 ⎦ ⎣ a0 a1 Discrete-Time a0 y [ n ] + a1 y [ n − 1] = b0 x [ n ] + b1 x [ n − 1] First solve a0 h 0 [ n ] + a1 h 0 [ n − 1] = δ [ n ] The eigenvalue is z = −a1 / a0 . The impulse response is of the form, h 0 [ n ] = Kz n u [ n ] . By recursion, h 0 [ 0 ] = 1 / a0 = K , a0 ≠ 0 . ( ) Therefore h 0 [ n ] = z n / a0 u [ n ] . Then, for the original equation, the impulse response is h [ n ] = b0 h 0 [ n ] + b1 h 0 [ n − 1] = b0 z n b z n−1 u[n] + 1 u [ n − 1] , a0 ≠ 0 a0 a0 h [ n ] = b0 h 0 [ n ] + b1 h 0 [ n − 1] = ( b0 / a0 ) ( −a1 / a0 ) u [ n ] + ( b1 / a0 ) ( −a1 / a0 ) n n −1 u [ n − 1] The unit sequence response is the accumulation of the impulse response. First find the accumulation of h 0 [ n ] . It is zero for n < 0 . For n ≥ 0 , n zm 1 1− z n+1 m ∑ h 0 [ m ] = ∑ a u [ m ] = (1 / a0 ) ∑ z = a 1− z , n ≥ 0 , a0 ≠ 0 m=−∞ m=−∞ 0 m=0 0 n n Therefore, for all time n, 1 1− z n+1 ∑ h 0 [ m ] = a 1− z u [ n ] , a0 ≠ 0 m=−∞ 0 n Then, the unit sequence response of the original system is b0 1− z n+1 b1 1− z n h −1 [ n ] = u[n] + u [ n − 1] , a0 ≠ 0 a0 1− z a0 1− z b0 ⎡1− ( −a1 / a0 ) h −1 [ n ] = ⎣ n+1 ⎤ u [ n ] + b1 ⎡1− ( −a1 / a0 )n ⎤ u [ n − 1] ⎦ ⎣ ⎦ , a0 ≠ 0 a0 (1+ a1 / a0 )