0% found this document useful (0 votes)
13 views24 pages

Major Assignment Group 20 Final

The document is an engineering assignment from Edith Cowan University, submitted by Group 20 on 27/10/2024, detailing their contributions and analysis of a signal and systems problem. It includes mathematical analysis, derivation of equations, and determination of system characteristics such as damping ratio and natural frequency. The team faced challenges with one member's inconsistent updates, affecting the timely completion of their sections.

Uploaded by

baileyrobstott
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views24 pages

Major Assignment Group 20 Final

The document is an engineering assignment from Edith Cowan University, submitted by Group 20 on 27/10/2024, detailing their contributions and analysis of a signal and systems problem. It includes mathematical analysis, derivation of equations, and determination of system characteristics such as damping ratio and natural frequency. The team faced challenges with one member's inconsistent updates, affecting the timely completion of their sections.

Uploaded by

baileyrobstott
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

Edith Cowan University – School of Engineering

Application To
Design Problem
Signal and Systems – ENS3553

Group 20
Date of Submission: 27/10/2024

Student Name Student ID Contribution Signature


Bailey Stott 10449034 Equal

Amr Tarif 10460659 Equal AT


Phub Tshering 10637514 Equal PT
Lucas Ward 10554948 Equal Lucas W
Team Contribution Description:
The team contributed even amounts of work to this assignment, we communicated and divided the
work appropriately with everyone’s approval.
Bailey completed section 1.
Lucas and Amir completed section 2
Phub completed section 3, but provided little and inconsistent updates on his progress, which
resulted in the section being completed late, thus leading to late submission of the assignment.
Section 1: Mathematical Analysis of System
1. Free Body Diagram

Figure 1: Free-Body Diagram of Forces Acting on the Mass

2. Show that the motion of the system can be described by the following LCCDE:

𝒅𝟐 𝒚(𝒕) 𝑪 𝒅𝒚(𝒕) 𝒌 𝑪 𝒅𝒙(𝒕) 𝒌


𝟐
+ + 𝒚( 𝒕 ) = + 𝒙(𝒕)
𝒅𝒕 𝒎 𝒅𝒕 𝒎 𝒎 𝒅𝒕 𝒎
Equation 1: Linear Constant-Coefficient Differential Equation

Accounting for x (position of input body/surface) and y (height of mass above reference level

𝑆𝑝𝑟𝑖𝑛𝑔 𝐹𝑜𝑟𝑐𝑒: 𝐹𝑠𝑝𝑟𝑖𝑛𝑔 = 𝑘𝑥 ( 𝑡) − 𝑘𝑦 (𝑡) ≫ Hooke’s Law (k = spring constant)


𝑑𝑥 (𝑡) 𝑑𝑦 (𝑡)
𝐷𝑎𝑚𝑝𝑒𝑟 𝐹𝑜𝑟𝑐𝑒: 𝐹𝑑𝑎𝑚𝑝𝑒𝑟 = 𝐶 −𝐶 ≫ (C = damping coefficient)
𝑑𝑡 𝑑𝑡

𝑑2 𝑦 (𝑡) 𝑑2 𝑦(𝑡)
𝐼𝑛𝑒𝑟𝑡𝑖𝑎𝑙 𝐹𝑜𝑟𝑐𝑒: 𝐹𝑖𝑛𝑒𝑟𝑡𝑖𝑎 = 𝑚 ≫ Newton’s 2nd Law (m = mass, = acceleration)
𝑑𝑡2 𝑑𝑡2

𝑇𝑜𝑡𝑎𝑙 𝐹𝑜𝑟𝑐𝑒 (𝐹𝑜𝑟𝑐𝑒 𝐵𝑎𝑙𝑎𝑛𝑐𝑒 ): 𝐹𝑖𝑛𝑒𝑟𝑡𝑖𝑎 = 𝐹𝑠𝑝𝑟𝑖𝑛𝑔 + 𝐹𝑑𝑎𝑚𝑝𝑒𝑟


𝑑 2 𝑦(𝑡) 𝑑𝑥 (𝑡) 𝑑𝑦 (𝑡)
∴ 𝑚 = 𝑘𝑥 ( 𝑡) − 𝑘𝑦 ( 𝑡) + 𝑐 − 𝑐
𝑑𝑡 2 𝑑𝑡 𝑑𝑡

Rearrange to describe the LCCDE (Equation 1):


𝑑 2 𝑦(𝑡) 𝑑𝑦 (𝑡) 𝑑𝑥 (𝑡)
𝑚 + 𝑐 + 𝑘𝑦( 𝑡) = 𝑐 + 𝑘𝑥( 𝑡)
𝑑𝑡 2 𝑑𝑡 𝑑𝑡
2 ( )
𝑑 𝑦 𝑡 𝑐 𝑑𝑦 ( 𝑡) 𝑘 𝑑𝑥 ( 𝑡)
𝑚[ + + 𝑦 ( 𝑡) ] = 𝑐 + 𝑘𝑥 (𝑡)
𝑑𝑡 2 𝑚 𝑑𝑡 𝑚 𝑑𝑡

𝑑 2 𝑦(𝑡) 𝑐 𝑑𝑦 ( 𝑡) 𝑘 𝑐 𝑑𝑥 (𝑡) 𝑘
2
+ + 𝑦 ( 𝑡) = + 𝑥 (𝑡)
𝑑𝑡 𝑚 𝑑𝑡 𝑚 𝑚 𝑑𝑡 𝑚
3. Use Laplace transform of Equation 1 to find an expression for the system transfer function
H(s)

𝑑 2 𝑦(𝑡) 𝑐 𝑑𝑦 ( 𝑡) 𝑘 𝑐 𝑑𝑥 (𝑡) 𝑘
𝐿𝑎𝑝𝑙𝑎𝑐𝑒 𝑇𝑟𝑎𝑛𝑠𝑓𝑜𝑟𝑚 𝑜𝑓 + + 𝑦 (𝑡) = + 𝑥(𝑡)
𝑑𝑡 2 𝑚 𝑑𝑡 𝑚 𝑚 𝑑𝑡 𝑚
𝑑 2 𝑦(𝑡)
𝐿{ } (𝑠) = 𝑠 2 𝑦 (𝑠) − 𝑠𝑦 ( 0) − 𝑦̇ (0)
𝑑𝑡 2
𝑐 𝑘 𝑐 𝑘
𝑠 2 𝑦( 𝑠) + 𝑠𝑦 (𝑠) + 𝑦 ( 𝑠) = 𝑠𝑥(𝑠) + 𝑥(𝑠)
𝑚 𝑚 𝑚 𝑚
𝑐 𝑘 𝑐 𝑘
𝑦(𝑠) [𝑠 2 + 𝑠+ ] = 𝑥(𝑠) [ 𝑠+ ]
𝑚 𝑚 𝑚 𝑚
𝑐 𝑘
𝑦(𝑠) 𝑠+ ] [
∴ 𝐻 (𝑠) = = 𝑚 𝑚
𝑥(𝑠) [𝑠 2 + 𝑐 𝑠 + 𝑘 ]
𝑚 𝑚
4. From Equation 1 and Equation 2, determine expressions for the damping ratio (ζ) and the
natural frequency (𝝎𝒏 ) in terms of the parameters m, k, and C

𝒅𝟐 𝒚(𝒕) 𝒅𝒚(𝒕)
+ 𝟐𝜻𝝎𝒏 + 𝝎𝒏 𝟐 𝒚(𝒕) = 𝟎
𝒅𝒕𝟐 𝒅𝒕
Equation 2: Homogenous Second Order Differential Equation

𝑐
𝐷𝑎𝑚𝑝𝑖𝑛𝑔 𝑅𝑎𝑡𝑖𝑜 ≫ 2𝜁𝜔𝑛 =
𝑚
𝑐
∴ 𝜁=
2(𝑚)(𝜔𝑛 )
𝑘
𝑁𝑎𝑡𝑢𝑟𝑎𝑙 𝐹𝑟𝑒𝑞𝑢𝑒𝑛𝑐𝑦 ≫ 𝜔𝑛 2 =
𝑚
∴ 𝜔𝑛 = √𝑘⁄𝑚

5. Determine the characteristic equation and eigenvalues for this system based on Equation
2 in terms of 𝝎𝒏 and ζ
𝑑2 𝑦(𝑡) 𝑑𝑦(𝑡)
Characteristic Equation of + 2𝜁𝜔𝑛 + 𝜔𝑛 2 𝑦(𝑡) = 0 is as follows:
𝑑 𝑡2 𝑑𝑡

𝑦 (𝑡) = 𝑒 𝜆𝑡

𝑆𝑢𝑏𝑠𝑡𝑖𝑡𝑢𝑡𝑒 𝑦 ( 𝑡) = 𝑒 𝜆𝑡 𝑖𝑛𝑡𝑜 𝐸𝑞𝑢𝑎𝑡𝑖𝑜𝑛 2:


𝜆2 𝑒 𝜆𝑡 + 2𝜁𝜔𝑛 𝜆𝑒 𝜆𝑡 + 𝜔𝑛 2 𝑒 𝜆𝑡 = 0

𝐷𝑖𝑣𝑖𝑑𝑒 𝑏𝑦 𝑒 𝜆𝑡 ( 𝑎𝑠 𝑖𝑡 ≠ 0) 𝑡𝑜 𝑜𝑏𝑡𝑎𝑖𝑛 𝑐ℎ𝑎𝑟𝑎𝑐𝑡𝑒𝑟𝑖𝑠𝑡𝑖𝑐 𝑒𝑞𝑢𝑎𝑡𝑖𝑜𝑛:


𝜆2 + 2𝜁𝜔𝑛 𝜆 + 𝜔𝑛 2 = 0
+ √ 𝑏2 −4𝑎𝑐
−𝑏−
Using Quadratic Formula the eigenvalues are determined as follows:
2𝑎
𝑎 = 1 & 𝑏 = 2𝜁𝜔𝑛 & 𝑐 = 𝜔𝑛 2

2𝜁𝜔𝑛 +

√(2𝜁𝜔𝑛 ) 2 − 4(1)( 𝜔𝑛 2 )
𝜆=
2 ( 1)
2𝜁𝜔𝑛 +

√4𝜁 2 𝜔𝑛 2 − 4𝜔𝑛 2
𝜆=
2
2𝜁𝜔𝑛 +

2𝜔𝑛 √𝜁 2 −1
𝜆=
2
+
𝜆 = −𝜁𝜔𝑛 − 𝜔𝑛 √𝜁 2 − 1
+
∴ 𝜆1,2 = −𝜁𝜔𝑛 − 𝜔𝑛 √𝜁 2 − 1

6. Using the answer from part 5, determine the full mathematical expression (in terms of 𝝎𝒏
and ζ) for the natural response of the system for the following cases:
i) 𝜻 = 𝟎
ii) 𝟎 < 𝜻 < 𝟏
iii) 𝜻 = 𝟏
iv) 𝜻 > 𝟏

i) 𝐹𝑜𝑟 𝜁 = 0:

𝑠1,2 = − ( 0)𝜔𝑛 + 2
− 𝜔𝑛 √( 0) − 1
+
𝑠1,2 = − 𝑗𝜔𝑛
∴ 𝑀𝑎𝑡ℎ𝑒𝑚𝑎𝑡𝑖𝑐𝑎𝑙 𝐸𝑥𝑝𝑟𝑒𝑠𝑠𝑖𝑜𝑛 𝑖𝑠: 𝑐 (𝑡) = 𝐴 cos(𝜔𝑛 𝑡 − 𝜙)

ii) 𝐹𝑜𝑟 0 < 𝜁 < 1:


+
𝑠1,2 = −𝜁𝜔𝑛 − 𝜔𝑛 √ 𝜁 2 − 1
∴ 𝑀𝑎𝑡ℎ𝑒𝑚𝑎𝑡𝑖𝑐𝑎𝑙 𝐸𝑥𝑝𝑟𝑒𝑠𝑠𝑖𝑜𝑛 𝑖𝑠: 𝑐 ( 𝑡) = 𝐴𝑒 𝜁𝜔𝑛 𝑡 cos ( 𝜔𝑛 √𝜁 2 − 1) 𝑡 − 𝜙

iii) 𝐹𝑜𝑟 𝜁 = 1:

𝑠1 ,2 = −(1)𝜔𝑛 + 2
− 𝜔𝑛 √1 − 1
∴ 𝑀𝑎𝑡ℎ𝑒𝑚𝑎𝑡𝑖𝑐𝑎𝑙 𝐸𝑥𝑝𝑟𝑒𝑠𝑠𝑖𝑜𝑛 𝑖𝑠: 𝑐 ( 𝑡) = 𝑎1 𝑒 −𝜔𝑛 𝑡 + 𝑏2 𝑡𝑒 −𝜔𝑛 𝑡
𝑐 (𝑡) = (𝑎1 + 𝑏2 𝑡)𝑒 −𝜔𝑛 𝑡

iv) 𝐹𝑜𝑟 𝜁 > 1:


+
𝑠1 ,2 = −𝜁𝜔𝑛 − 𝜔𝑛 √ 𝜁 2 − 1𝑖

−𝜔 (−𝜁+√𝜁 2 −1 )𝑡 −𝜔 𝑛 (−𝜁−√𝜁 2 −1 )𝑡
∴ 𝑀𝑎𝑡ℎ𝑒𝑚𝑎𝑡𝑖𝑐𝑎𝑙 𝐸𝑥𝑝𝑟𝑒𝑠𝑠𝑖𝑜𝑛 𝑖𝑠: 𝑐 (𝑡) = 𝑏1 𝑒 𝑛 + 𝑏2 𝑒

7. Determine 𝝎𝒏 (in rad/s) for this system and the corresponding value for 𝒇𝒏 (in Hz):

Determining 𝜔𝑛 in rad/s:

𝑘 𝑘 = 15,000 𝑁 ⁄𝑚
𝜔𝑛 = √ ≫
𝑚 𝑚 = 380 𝑘𝑔

15000
∴ 𝜔𝑛 = √ = 6.28280 ≈ 6.3 𝑟𝑎𝑑 ⁄𝑠
380

Determining 𝑓𝑛 in Hz:
𝜔𝑛 6.28280
𝑓𝑛 = = = 0.99993 ≈ 1.00 𝐻𝑧
2𝜋 2𝜋

8. Calculate the required value of 𝑪𝒔 in order to achieve ζ = 1:


𝑐
From part 4: 𝜁 = & 𝜔𝑛 = √𝑘⁄𝑚
2(𝑚)(𝜔 𝑛 )

𝑐
Substituting 𝜔𝑛 into other equation ≫ 𝜁 =
2 (𝑚) (√𝑘⁄𝑚 )

𝑐
∴1=
2 ( 380) ( √15000⁄380)

𝑅𝑒𝑎𝑟𝑟𝑎𝑛𝑔𝑒: 𝑐 = 2(380) (√15000⁄380)

∴ 𝑐 = 4774.934555 ≈ 4775
Section 2: System Analysis Using MATLAB

9. Plot the impulse response and step response of the system (for 2 seconds duration and
time ‘step size’ of 1 millisecond)

𝑑 2 𝑦( 𝑡) 𝑐 𝑑𝑦 (𝑡) 𝑘 𝑐 𝑑𝑥 (𝑡) 𝑘
2
+ + 𝑦 ( 𝑡) = + 𝑥 ( 𝑡)
𝑑𝑡 𝑚 𝑑𝑡 𝑚 𝑚 𝑑𝑡 𝑚
Sub in 𝑐 = 4775, 𝑚 = 380 and 𝑘 = 15000:

𝑑 2 𝑦(𝑡) 4775 𝑑𝑦 (𝑡) 15000 4775 𝑑𝑥 (𝑡) 15000


+ + 𝑦 ( 𝑡) = + 𝑥 (𝑡)
𝑑𝑡 2 380 𝑑𝑡 380 380 𝑑𝑡 380

Figure 2: Impulse response

Figure 3: Step response


10. Determine the frequency response from 0 to 200 rad/s using the freqs command. Plot the
magnitude and phase response over this frequency range.
11. Determine the magnitude response at 𝝎𝒏 . Determine the frequency of the -3dB point
(magnitude = 𝟏/√𝟐 of passband).
1
= 0.7071
√2
From graph:

Take X value at the measured point where Y value is as close as possible to 0.7071 rad/sec.

The corresponding frequency at the -3dB point (when magnitude = 1/√2) is 15.6 rad/second.
12. Discuss the response of the system. Why do the impulse and step responses have that
particular shape? How well will this system fulfil its purpose of a vehicle suspension?
Note: The function of a suspension system is to ‘filter out’ the effect of bumps, potholes and
other such road surface irregularities, but allow the vehicle to ‘follow the road’ as the height of
the road surface varies.

The impulse response represents the system’s behavior to a high energy input signal that
occurs suddenly and briefly, an impulse input. In relation to the design problem, the impulse
input conveys the sudden displacement of the suspension system caused by traveling on
uneven surfaces, such as potholes or speed bumps. In Figure 2, the plot portrays the damping
of the second order system, where, according to the MATLAB code, the system is critically
damped, as the damping coefficient, d, is equal to 1. In a mass- damping system, after the
displacement occurs from the input, the system attempts to return to equilibrium by
dissipating the displacement energy through oscillating. The damper mechanism in the system
controls the oscillations through decreasing their amplitudes over time until steady state is
reached. The damping coefficient, d, determines the rate of oscillations and state of the
system. However, as mentioned earlier, the system is in a critically damped state, where
oscillations do not occur due to displacement energy directly dissipating to the damper
mechanism. This is displayed in figure 2, where the impulse response relatively decreases
linearly, smoothly, towards its steady state, or equilibrium position.

On the other hand, in Figure 3, the system displays effects of a continuous input function, a
step function u(t). The impulse response displayed a rise initially to display the effects of the
input function, going over a bump, without overshooting or oscillating. Subsequently, the
impulse response smoothly decays until leveling off, indicating that steady state have been
retained.

From understanding of the problem, a critical damped system will fulfil the purpose of allowing
the car to follow the road closely due to the lowered probability of the car losing control from
oscillations, as the system both dissipates the displacement’s impulse energy from bumps
and returns the car to equilibrium quickly without oscillating. However, in terms of filtering
effects of uneven surfaces, if the magnitude of the bumps displacement energy is very high,
the lack of oscillations will result in a portion of that energy dissipating to the car’s damping
mechanism, the shock absorbers, while the remaining energy would dissipate through the
car’s body, ultimately affecting the ride quality and, therefore, failing to satisfy the purpose of
filtering the effects of uneven surfaces. Therefore, designing a suspension system with a
damping coefficient close to but not equal to 1 to benefit from both the advantages of
underdamped and critical systems will better fulfill the purpose of the suspension. For further
clarification, an underdamped suspension system will allow the bumps energies to dissipate
through oscillations more efficiently, thus, preserving the ride’s comfort. However, having a
damping coefficient close to 1 will control the rate and magnitude of those oscillations, thus
preserving the car from losing control while traveling over uneven surfaces. Therefore, based
on plots from step 13 and to answer question 14, the damping coefficient of 0.7 is best for
application as a suspension system
1. Repeat the analysis above (steps 9 -11) for the following damping ratios:

a. damping ratio = 0.4

b. damping ratio = 0.7


c. damping ratio = 1.5

d. damping ratio = 2.0

Section 3
1. The response of the suspension system designed in Section 2 can be modelled by
providing an input x that resembles the road input (the assumption is that the tyre
assembly does not impact the system response and therefore x is the same as road
‘input signal’ r). The M-file for the custom-written function inputsig has been provided,
with explanatory comments in the file.
Use the inputsig function to generate a sinusoid of 1 Hz with magnitude 0.5 and duration
5seconds, then simulate the suspension system’s response to this function and plot the
input and output response vs time (output plot below input plot for easy comparison).
Hint 4: The system response to an input signal can be simulated using the lsim function.
Following is some sample code that shows how this function could be used.

[xsig, t1] = inputsig(10); % generate signal duration 10

Sys1 = tf(B,A); % define system, use tf (transfer function)


Sysout = lsim(Sys1, xsig, t1); % simulate LTI system response

Note: Students are advised to refer to the help function within Matlab as well as the online
Matlab documentation for more details (10 marks)

Solutions:

The user-defined function inputsig.m is capable of creating sine, square, and pulse waves, as
well as a mixed signal, displayed in the image below.

Used a subplot that demonstrates the three separate signals as well as the combined signal in
a single figure.

Code:
function [xx, tt] = inputsig(duration)
% INPUTSIG Function to generate periodic input signal
% that is a combination of 3 different signals
% default - sin, square and pulse combination
% [xx,tt] = inputsig(duration)
% duration = duration of signal waveform in seconds
%
% Users can change the amplitude and frequency of each signal
% By changing the constants at the start
% Timestep = time between samples
% The 3 frequency and 3 magnitude values
% Note: Individual signal types can be changed - 'sin', 'square' or 'pulse'

if (nargin < 1)
duration = 1; % gives 1 second length signal by default
end
timestep = 1e-5; % default time step 1e-5, change as required

sig1_freq = 1; % frequency of 1st signal


sig1_mag = 1; % magnitude of 1st signal

sig2_freq = 2; % frequency of 2nd signal


sig2_mag = 0.1; % magnitude of 2nd signal

sig3_freq = 3; % frequency of 3rd signal


sig3_mag = 0; % magnitude of 3rd signal

% Section to generate the 3 signals with specified frequencies


[sig1, t1] = gensig('sin', (1/sig1_freq), duration, timestep);
[sig2, t2] = gensig('square', (1/sig2_freq), duration, timestep);
[sig3, t3] = gensig('pulse', (1/sig3_freq), duration, timestep);

tt = t1; % generated signal timebase


xx = sig1_mag*sig1 + sig2_mag*sig2 + sig3_mag*sig3; % output = scaled sum of generated
signals

% creating subplots to display each signal


figure; % Create a new figure window

% Subplot for the sine wave


subplot(4, 1, 1); % 4 rows, 1 column, first subplot
plot(t1, sig1);
title('Sine Wave');
xlabel('Time (s)');
ylabel('Amplitude');
grid on;

% Subplot for the square wave


subplot(4, 1, 2); % second subplot
plot(t2, sig2);
title('Square Wave');
xlabel('Time (s)');
ylabel('Amplitude');
grid on;

% Subplot for the pulse wave


subplot(4, 1, 3); % Pluse plot
plot(t3, sig3);
title('Pulse Wave');
xlabel('Time (s)');
ylabel('Amplitude');
grid on;

% Subplot for the combined signal


subplot(4, 1, 4); % Combined Signal
plot(tt, xx);
title('Combined Signal');
xlabel('Time (s)');
ylabel('Amplitude');
grid on;
End

This function suffers from memory issues because of a very large timestamp value.

Thus, we have revised the function to generate a sine wave which is utilized to give input to the
system. This is how it functions.

Code:
function [xx, tt] = inputsig(duration, sig_type, freq, mag)
% INPUTSIG Function to generate a specific type of periodic input signal
% [xx, tt] = inputsig(duration, sig_type, freq, mag)
% - duration: duration of the signal in seconds
% - sig_type: type of signal (‘sin’)
% - freq: frequency of the signal in Hz (default = 1 Hz)
% - mag: magnitude of the signal (default = 1)
if nargin < 1
duration = 1; % Default duration of 1 second
end
if nargin < 2
sig_type = 'sin'; % Default signal type is sine
end
if nargin < 3
freq = 1; % Default frequency of 1 Hz
end
if nargin < 4
mag = 1; % Default magnitude of 1
end
timestep = 1e-3; % Set a reasonable timestep to reduce memory usage
tt = 0:timestep:duration; % Time vector

% Generate the specified signal type


switch lower(sig_type)
case 'sin'
xx = mag * sin(2 * pi * freq * tt); % Sinusoidal wave
case 'square'
xx = mag * square(2 * pi * freq * tt); % Square wave
case 'pulse'
xx = mag * (mod(tt, 1/freq) < (1/(2*freq))); % Pulse wave
otherwise
error('Invalid signal type. Choose "sin", "square", or "pulse".');
end
% Plot the generated signal
figure;
plot(tt, xx);
title([sig_type ' Wave (' num2str(freq) ' Hz, Magnitude ' num2str(mag) ')']);
xlabel('Time (s)');
ylabel('Amplitude');
grid on;
End

The lsim function is applied to determine the LTI system's output in response to a sinusoidal
input at 1 Hz, 0.5 amplitude, and 5 seconds duration.
Note: The transfer function coefficients are Num: 1 and Den: 2, 3.

Code:
% Generate the input signal (1 Hz sinusoid with magnitude 0.5, duration 5 seconds)
[xx, tt] = inputsig(5, 'sin', 1, 0.5);

% Define the transfer function of the LTI system


num = [1]; % Numerator coefficients
den = [2 3]; % Denominator coefficients (s + 1)
sys = tf(num, den); % Create transfer function model note that transfer function
coefficients and constants are given randomly here

% Compute the system response to the input signal


[y, t_out] = lsim(sys, xx, tt); % Compute system output using lsim function

% Plot the input and output signals


figure;

% Plot the input signal


subplot(2, 1, 1);
plot(tt, xx, 'b');
title('Input Signal: Sinusoidal Wave (1 Hz, 0.5 Magnitude)');
xlabel('Time (s)');
ylabel('Amplitude');
grid on;

% Plot the output signal


subplot(2, 1, 2);
plot(t_out, y, 'r');
title('System Output Signal');
xlabel('Time (s)');
ylabel('Amplitude');
grid on;

% Improve the layout and spacing for better visibility


sgtitle('Input and Output Signals for the LTI System');

Output display:

.
2.For a given periodic signal y(t) = cos (Pi t) with fundamental period T0 = 2 sec.

a) Will the expanded signal y(t/2) be periodic? If periodic indicate its period.

→ Yes, it is periodic at 4 sec

b) Is the compressed signal y(2t) periodic? If periodic indicate its period.

→ Yes, it is periodic at 1 sec

c) Use Matlab to plot the above two signals and verify your results. Present the matlab

code in support of your answer


Solution:

t=0:0.01:10;

y=cos(pi*(t/2));

z=cos(pi*2*t);

subplot(1,2,1);

plot(t,y);

xlabel('time');

ylabel('y(t/2)')

subplot(1,2,2);

plot(t,z);

xlabel('time');

ylabel('y(t*2)')

3. n = 0: 50; % values of the time variable

w = 0.5*2*pi; % frequency of the sinusoid

phi = 0; % phase offset

A = 2.5; % amplitude

xn = A * cos(w*n - phi); stem(n, xn);

axis([0 50 -2 2]);

grid;

title (’Discrete Time Sinusoid’);

xlabel (’Time index n’); ylabel (’x[n]’);

d) Type in this code and run it. What type of signal is obtained?

→ discrete time signal

e) What is the length of the signal x[n]?

→ 50

f) What is the fundamental period of x[n]?

→ 2 sec

g) What is the purpose of the grid command?


→ For displaying amplitude of the signal

h) Modify the code so that it generates a sinusoid with length 100, frequency 0.8 × 2 π radians

per sample, amplitude 5.5, and a phase offset of π/2 radians. Run the modified code to

generate and plot another discrete-time sinusoid. All matlab codes should be presented

in the answer.

(1+1+1+1+6 marks)

Solution:

n = 0: 50; % values of the time variable

w = 0.5*2*pi; % frequency of the sinusoid

phi = 0; % phase offset

A = 2.5; % amplitude

xn = A * cos (w*n - phi); stem (n, xn);

axis ([0 50 -2 2]);

grid;

title ('Discrete Time Sinusoid');

xlabel ('Time index n'); ylabel ('x[n]');

part h

n = 0: 100; % values of the time variable

w = 0.8*2*pi; % frequency of the sinusoid

phi = (pi/2); % phase offset

A = 5.5; % amplitude

xn = A * cos (w*n - phi); stem (n, xn);

axis ([0 100 -2 2]);

grid;

title ('Discrete Time Sinusoid');

xlabel ('Time index n'); ylabel ('x[n]');

Question 4.

a. Use Matlab to generate and plot the discrete-time signal x[n] = cos(0.09n) for 0 ≤ n ≤ 120.
For your plot, turn the grid on and scale the axes using the Matlab statements

axis ([0 120 -1.0 1.0]);

grid;

Solution:

n = 0: 120; % values of the time variable

w = 0.09; % frequency of the sinusoid

phi = (0); % phase offset

A = 1; % amplitude

xn = A * cos(w*n - phi); stem(n, xn);

axis([0 120 -1.0 1.0]);

grid;

title ('Discrete Time Sinusoid');

xlabel ('Time index n'); ylabel ('x[n]');

b. Is this signal periodic? Explain.

Matlab code should be presented in the answer

→ This signal is periodic since it is repeating itself.

Question 5

n = -10:10; % values of the time variable

delta_n = [zeros(1,10) 1 zeros(1,10)];

stem(n, delta_n);

axis([-10 10 0 1.5]);

title(’Unit Sample Function’);

xlabel(’Time index n’);

ylabel(’\delta[n]’);

a) Type in this code and run it. What type of signal is obtained?

When entering and running the code in the MATLAB command window, we obtain a unit sample signal.
A unit sample signal is defined as a signal with an amplitude of 1 at n=0. Mathematically, it is expressed
as:

δ(n)={1, n=0

0, if n ≠0 }
b) Modify the code above to generate and plot δ[n − 3] for −10 ≤ n ≤ 10.

→ To plot δ(n−3), the impulse with an amplitude of 1 should occur at n=+3. δ(n−3) represents a
time-shifted version of δ(n), meaning it is delayed by 3 units. In MATLAB, the impulse can be
shifted to n=3 by using the following code:

n = -10:10; % defining time variable

delta_n = [zeros(1,13) 1 zeros(1,7)]; % time delayed unit impulse function by 3 units

stem(n, delta_n); % Plotting the shifted unit sample function δ[n - 3]

axis([-10 10 0 1.5]); % Adjust the axis limit

title('Shifted Unit Sample Function'); % Add title

xlabel('Time index n'); % Add label

ylabel('\delta[n - 3]', 'Interpreter', 'latex'); % add label with LaTeX formatting

c) Use the Matlab functions ones and zeros to generate and plot the signal u[n] for −10 ≤ n≤ 10.
u(n) is a discrete-time unit step function, defined mathematically as:

u(n) = { 1 n≥0

0, for n<0 }

By running the code below we can generate a unit step function for -10 ≤ n ≤ 10 :

clc; % clearing the command window

clear all; % clearing user defined variables

close all; % closing any pop ups like figures

n = -10:10; % we define time variable

un = [zeros(1,10), ones(1,11)]; % 10 zeroes for -10 to -1 and 11 zeros from n=0 to n=10

stem(n, un); % plot the function using stem commend

axis([-10 10 -0.5 1.5]); % defining the x - axis

title('Unit Step Function u[n]'); % giving title name

xlabel('Time index n');

ylabel('u[n]'); % names of x and y axis in these 2 lines

grid on; % turn on the grid for better visibility

d) Generate and plot u[−n − 2] for −10 ≤ n ≤ 10.

All matlab codes should be presented in the answer


Solution:

This signal is a time-reversed (flipped) and shifted version of the discrete-time unit step signal.so to
generate this signal,

First draw a unit step signal

Now flip the signal to generate u(-n)

Finally shift the sample to the left side by unit 2

Code:

n = -10:10; % define time axis


un_shifted_flipped = double (n <= -2);
stem(n, un_shifted_flipped);
axis([-10 10 -0.5 1.5]); % Axis
title('Unit Step Function u[-n - 2]');
xlabel('Time index n');
ylabel('u[-n - 2]');
grid on

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy