GUI assignments
Que. No. Batches
1 Tuesday 1,2,3
2 Tuesday 4,5,6
3 Tuesday 7,8,9
4 Tuesday 10,11,12
5 Tuesday 13,14,15
6 Tuesday 16,17,18
7 Tuesday 19,20,21
8 Tuesday 22,23,24
9 Tuesday 25,26,27
10 Thursday 1,2,3
11 Thursday 4,5,6
12 Thursday 7,8,9
13 Thursday 10,11,12
14 Thursday 13,14,15
15 Thursday 16,17,18
16 Thursday 19,20
Q.1 - Show the demo of sampling and aliasing using GUI in MATLAB.
You can choose the input signal as sinusoidal signal. Provide control to user
to vary the frequency from 0 Hz to Fs Hz. (Fs value can be Fixed.)
Freq of the i/p
sinusoidal signal
slider
Input signal and Single-sided spectra of i/p and
sampled signal (From sampled signal (X-axis should
time index 0 to N-1) indicate frequency scale from 0 to
Fs/2)
Axes1 Axes2
Q.2 - Show the demo of various operations on signals using MATLAB
GUI. You can choose any basic signals of finite length. Also, signals can be
of shorter duration than the x-axis, so that x-axis value need not be changed
while performing operations.
Drop-Down menu
x1(n) in time
domain:
Choose various operations using
drop-down menu:
1) Addition of two signals x1(n) +
x2(n) Axes1
2) Multiplication of signals x1(n) x2(n) in time
x2(n) domain
3) Time shifting y(n) = x1(n±k)
4) Time scaling y(n) = x1(α n)
Axes2
Time shifting:
y(n) in time
slider1 domain
Time scaling:
slider2
Axes3
Q.3 - Show the demo of convolution (of discrete-time signals) using
MATLAB GUI. You can choose the length of signals. Allow user to
vary the element alpha in the h[n] signal.
Signal: x(n) = u[n] –u[n-p];
:
slider
x(n) in time h(n) in time y(n) in time
domain domain domain
Axes1 Axes2 Axes3
Q.4 - Show the demo of DTFT of certain types of DT signals. Allow
user to vary parameters of signals as specified. Provide a radio-button
for user to choose one among the following signal. Provide control to
change value of alpha and L.
:
slider1
:
slider2
panel
x(n) in time DTFT of signal (Magnitude
domain spectrum from –pi to pi)
Axes1 Axes2
Q.5 - Let user enter the location of poles and zeros. Use this information to
plot the pole-zero plot and magnitude response of the system in the range of
–pi to pi. Use 2 poles and 2 zeros system - can be real or complex
conjugates roots.
Enter location of zeros
(real and img values)
Edit-texts
Enter location of poles
(real and img values)
Pole-Zero Map of the system Mag response of the system
Axes1 Axes2
Q.6 - Consider a simple first order FIR filter (with Pole at origin). In
GUI, zero location should be adjustable using left-right arrow. Location
can be changed from z =-1 to z=1 in the increment of 0.1. Show the
corresponding pole-zero map and Magnitude response of the system.
Similarly, a zero can be fixed at origin, and vary location of pole from 0.9
to -0.9 on real axis.
Location of
For a pole at origin
zero
Pole-Zero Map of the system Mag response of the system
Axes1 Axes2
Q.7. Generate and plot a square-wave by adding harmonic signals using
MATLAB GUI. Use edit-text to enter the number of harmonics, two static-texts
to display the array of harmonic frequencies and amplitudes, a push-button to
initiate addition, and an axes to plot the square-wave. (Let the fundamental
frequency be 10Hz.)
ADD
No. of harmonics:
edit-text push-button
Harmonic Freq:
static-text1
Amplitudes:
Axes
static-text2
Q.8. Design and test the low-pass filter nature of a moving-average filter using
MATLAB GUI. Consider sinusoidal signal as input, add random-noise to
generate a noisy signal, obtain filtered-signal by passing the noisy-signal through
the designed moving-average filter. Use a slider to vary the value of M, and
radio-buttons to choose the input/output plots. Also plot the magnitude and phase
response of the designed filter.
M:
Magnitude Response
slider Input/Output
Axes2
Input-signal
Phase Response
Noisy-signal
Filtered-signal
Axes3
panel Axes1
Q.9. Generate and plot the single-sided magnitude, and phase spectrum of the
following added signal x(t) = A1 cos(2 f1 t) + A2 cos(2 f2 t) + …….. using
MATLAB GUI. Use slider to choose the number of cosine signals to be added,
and two edit-texts to enter the values of amplitudes A and frequencies f.
No. of
Cosines: Magnitude Spectrum
slider Time-domain Signal
Axes2
A:
edit-text
Phase Spectrum
f:
edit-text
Axes1
Axes3
Q.10 - Show the even and odd parts of an input signal . Also, show the
Magnitude spectrum (two-sided) of even and odd parts.
Time domain
x(n):
Magnitude spectrum
Axes1
Axes2 Axes4
Axes3 Axes5
𝒂
Q.11 - Determine whether the systems, System 1: and
𝟏/𝒂
System 2: form a pair of the invertible system of not.
Here, and are the input and output, respectively, of each
individual system. Also, is a variable. In order to check the invertibility,
cascade System 1 with System 2. The output of System 1 will be the input
to System 2. Give input to System 1 in cascaded structure and then observe
the output from System 2.
Output of
System 1:
slider
Input to
System 1: Axes2
Output of
System 2:
Axes1
Axes3
Q.12 - Through GUI, check whether the system is linear or
not. The value of can be 0 or 1 Give an input and observe the output
. Similarly, give input and observe the output . Then add the
obtained outputs and . Next, give the input to the
given system and observe the obtained output (Let’s say ). Check
is equal to or not.
𝟏 𝟐
slider
Axes5
𝟏 𝟐
𝟏 𝟐
Axes1 Axes3
𝟏 𝟐 Axes6
𝟑
Axes2 Axes4
Axes7
Q.13 - Generate a periodic square wave x[n] with period 2N. It is defined as
Where . Compute its discrete-time Fourier series coefficients c[k] through
the following formula:
Perform the following tasks:
1) Fix N, vary the value of and observe the effect on plot.
2) Fix , vary the value of N and observe the effect on plot.
DTFS plot
𝟏
slider1
slider2
Axes
Q.14 - Consider three signals , and of different lengths. Add
all of them to obtain a composite signal (perform zero padding for addition
in case lengths of three signals are different.) Verify Parseval’s relation for
composite and each individual signals , and . Let
and be the energy of computed in the time domain and frequency
domain, respectively.
𝟏 𝒕 𝟏 𝒇 𝟏
Axes1 Axes5 Axes9
𝟐 𝒕 𝟐 𝒇 𝟐
Axes2 Axes6 Axes10
𝟑 𝒕 𝟑 𝒇 𝟑
Axes3 Axes7 Axes11
𝟒 𝒕 𝒇
Axes4 Axes8 Axes12
Q.15 Given x(n) = [1,2,3,4,5,6,7,6,5,4,3,2,1]; -2<n<10, determine and plot the
following sequences using MATLAB GUI. a). x1(n) = 2x(n-5) - 3x(n+4), b).
x2(n) = x(3-n) + x(n)x(n-2), c). x3(n) = x1(n) + x2(n).
Use edit-text to enter the array of x(n). (Here, one example has been given).
Plot x1(n) and x2(n) in two different GUI axes, initialize the addition of two
sequences using a push-button and plot x3(n) in different axes.
ADD
x:
push-button
edit-text
x1(n): x2(n): x3(n):
Axes1 Axes2 Axes3
Q.16 Generate and plot the following sequence x(n) = A1 u(n-N1) + A2 delta(n-
N2) + A3 u(-n-N3); using MATLAB GUI, where, [A1, A2, A3] and [N1, N2,
N3] are the amplitudes and time-shifts of each signals. Use 2 separate edit texts to
enter the value of amplitudes and time-shifts.
Amplitude: edit-text1
Time-shift:
edit-text2
Axes