Table of Contents: 1. Assigned time function and MatLab Plot.......................................…………3 2. Script file of Laplace Transform, F(s), for the time function f(t)…...……... 3 3. Step Response example………………………………………………..…….4 4. Convolution example………………………………………………..…...….6 5. Appendix and References...………………………………………………….8 a. Source Code……………………………………………………...…...8 Antoaneta Mutafchieva I. Assigned time function: f(t) = tsin(bt) +cos(at) A = 4; B = 10; C = 2.4; D = 2; Plot 1 II. Script file that returns the Laplace Transform, F(s), for the time function f(t). %%%%% Laplace Transform F(s) Partition %%%%% syms f t s f = t*sin(B*t) + cos(A*t); laplace(f) ans = s/(s^2 + 16) + (20*s)/(s^2 + 100)^2 2 Antoaneta Mutafchieva Fig 1 - Screenshot of the source code and Laplace Transform return III. Step Response example - Describe briefly what the following code does >> plant_controller = tf([24], [1 3 24]) >> impulse(plant_controller) >> step(plant_controller) The first line of the code above creates a 2nd order transfer function assigned to the name plant_controller. 24 ------------------ Continuous time transfer function s^2 + 3s + 24 The following two lines are the impulse response and the step response of the system as shown in the plots below. 3 Antoaneta Mutafchieva Plot 2 – Impulse Response Polt 3 – Step response 4 Antoaneta Mutafchieva IV. Convolution example Describe briefly what the following command does (you can type “help ones” at the i. prompt): >> x = ones(1,5); The command above creates a matrix of ones with size 1x5 (1 row/ 5 columns). ii. Execute these commands and copy the plot into your Word document >> x = ones(1,10); >> h = ones(1,5); >> y = conv(x,h); >> plot(y); >> pause >> stem(y) Plot 4 - Convolution plot 5 Antoaneta Mutafchieva Plot 5 - Stem plot 1) Explain what the code does The code above creates matrix x of ones with size 1x10, x = [1 1 1 1 1 1 1 1 1 1] and matrix h of ones with size 1x5, h = [1 1 1 1 1]. Then plot(y) represent the convolution of the two matrices, Execution is paused until a key is entered and the stem plot(y) is shown. 2) and Determine whether or not the results, specifically the horizontal axis values, are what you expected them to be. Explain why or why not. The x-axis of the convolution plot represent the length of the two matrices convolved. Length(l) = length(x) + length(h) – 1, in this case 10 + 5 – 1 = 14. The y-axis represents the highest coefficient of the convolution, in this case 5. x = [1 1 1 1 1 1 1 1 1 1] x9 + x8 + x7 + x6 + x5 + x4 + x3 + x2 + x + 1 h = [1 1 1 1 1] x4 + x3 + x2 + x + 1 Convolution y = (x*h) contains the coefficients of the polynomial multiplication y = [1 2 3 4 5 5 5 5 5 5 4 3 2 1] 3) Which, in your opinion, is better, the “plot” function or the “stem” function? I like both “plot” and “stem” functions. Depending on assignment, and more important number of plots to be generated and observed, maybe I would choose plot. I prefer continuous values of curves rather than the discrete points. 6 Antoaneta Mutafchieva Appendix A: Source Code % Source code written by Antoaneta Mutafchieva % 03/27/2021 clf clc clear all %%%%% Wave Transformations Partition %%%%% A = 4; B = 10; C = 2.4; D = 2; t = 1:1000; % time array g = @(t) sin(t/30); % original sine wave g1(t) = A*g(t+10); % 1st transformation g2(t) = C*g(2*t); % 2nd transformation plot(t(1:500),g(1:500),'b', t(1:500),g1(1:500),'g', t(1:500),g2(1:500),'r') %%%%% Laplace Transform F(s) Partition %%%%% syms f t s f = t*sin(B*t) + cos(A*t); laplace(f) %expected ans = (2*B*s)/(s^2 + B^2)^2 + s/(s^2 + A^2); legend('g(t) = sin(t/30)', 'g1(t) = A*g(t + B)', 'g2(t) = C*g(D*t)') figure (gcf) title ('Scaled and Translated Waves - AM'); % pause - execution pauses until key is entered xlabel('Time'); ylabel('Value'); 7