0% found this document useful (0 votes)
16 views5 pages

EEE 4702 Assignment 02 200021133

The document outlines a series of MATLAB programs related to signal processing, including sampling theorem verification, upsampling, downsampling, and impulse response analysis. It also discusses various system classifications such as linear vs nonlinear, time-invariant vs time-variant, memory vs memoryless, causal vs noncausal, and stable vs unstable systems. Each program demonstrates specific concepts in signal processing through graphical representations and user inputs.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views5 pages

EEE 4702 Assignment 02 200021133

The document outlines a series of MATLAB programs related to signal processing, including sampling theorem verification, upsampling, downsampling, and impulse response analysis. It also discusses various system classifications such as linear vs nonlinear, time-invariant vs time-variant, memory vs memoryless, causal vs noncausal, and stable vs unstable systems. Each program demonstrates specific concepts in signal processing through graphical representations and user inputs.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
You are on page 1/ 5

EEE 4702

Experiment 2
Name: Syed Mohammad Ahnaf Farukh
Section: A1
ID: 200021133

Program 1:
clc;
T=0.04; % Time period of 50 Hz signal
t=0:0.0005:0.02;
f = 1/T;
n1=0:40;
size(n1)
ans = 1×2
1 41
xa_t=sin(2*pi*2*t/T);
subplot(2,2,1);
plot(200*t,xa_t);
title('Verification of sampling theorem');
title('Continuous signal');
xlabel('t');
ylabel('x(t)');
ts1=0.002;%>niq rate
ts2=0.01;%=niq rate
ts3=0.1;%<niq rate
n=0:20;
x_ts1=2*sin(2*pi*n*ts1/T);
subplot(2,2,2);
stem(n,x_ts1);
title('greater than Nq');
xlabel('n');
ylabel('x(n)');
n=0:4;
x_ts2=2*sin(2*pi*n*ts2/T);
subplot(2,2,3);
stem(n,x_ts2);
title('Equal to Nq');
xlabel('n');
ylabel('x(n)');
n=0:10;
x_ts3=2*sin(2*pi*n*ts3/T);
subplot(2,2,4);
stem(n,x_ts3);
title('less than Nq');
xlabel('n');
1
ylabel('x(n)')
Program 2:
clc;
clear all;
close all;
L=input('enter the upsampling factor');
D=input('enter the downsampling factor');
N=input('enter the length of the input signal');
f1=input('enter the frequency of first sinusoidal');
f2=input('enter the frequency of second sinusoidal');
n=0:N-1;
x=sin(2*pi*f1*n)+sin(2*pi*f2*n);
y=resample(x,L,D);
subplot(2,1,1)
stem(n,x(1:N))
title('input sequence');
xlabel('time(n)');
ylabel('amplitude');
subplot(2,1,2)
m=0:N*L/D-1;
stem(m,y(1:N*L/D));
title('output sequence ');
xlabel('time(n)');
ylabel('amplitude');
2
Program 3:
clc;
clear all;
close all;
D=input('enter the downsampling factor');
L=input('enter the length of the input signal');
f1=input('enter the frequency of first sinusoidal');
f2=input('enter the frequency of second sinusoidal');
n=0:L-1;
x=sin(2*pi*f1*n)+sin(2*pi*f2*n);
y=decimate(x,D,'fir');
subplot(2,1,1);
stem(n,x(1:L));
title('input sequence');
xlabel('time(n)');
ylabel('amplitude');
subplot(2,1,2)
m=0:(L/D)-1;
stem(m,y(1:L/D));
title('Decimated sequence');
xlabel('time(n)');
ylabel('amplitude');
3
Program 4:
clc;
clear all;
close all;
L=input('enter the upsampling factor');
N=input('enter the length of the input signal'); % Length should be
greater than 8
f1=input('enter the frequency of first sinusodal');
f2=input('enter the frequency of second sinusodal');
n=0:N-1;
x=sin(2*pi*f1*n)+sin(2*pi*f2*n);
y=interp(x,L);
subplot(2,1,1)
stem(n,x(1:N))
title('input sequence');
xlabel('time(n)');
ylabel('amplitude');
subplot(2,1,2)
m=0:N*L-1;
stem(m,y(1:N*L))
title('output sequence ');
xlabel('time(n)');
ylabel('amplitude');
4
Program 5:
clc; close all;
clear all; n=0:10;
%impulse response of first order system y(n)-0.9*y(n-1)=2*x(n)
b=[2 0 0];
a=[1 -0.9 0];
y=dimpulse(b,a,length(n));
subplot(2,1,1);
stem(n,y);
xlabel('n--->');
ylabel('amplitude');
title('impulse response of first order system');
%impulse response of second order system y(n)+0.6*y(n-1)+0.8*y(n-
2)=x(n)
b=[1 0 0]; a=[1 0.6 0.8];
y1=dimpulse(b,a,length(n));
subplot(2,1,2);
stem(n,y1);
xlabel('n---->');
ylabel('amplitude');
title('impulse response of second order system');
5
Program 6:
clc;
clear all;
b=input('Enter the numerator coefficients:');
a=input('Enter the denominator coefficients:');
[h,w]=freqz(b,a);
subplot(2,1,1);
plot(w/pi,abs(h));
grid;
xlabel('Normalised Frequency');
ylabel('Magnitude in dB');
title('Magnitude Response');
subplot(2,1,2);
plot(w/pi,angle(h));
grid;
xlabel('Normalised Frequency');
ylabel('phase in radians');
title('Phase Response');

1. Linear and Nonlinear Systems:


• Linear Systems:A linear system adheres to the principles of superposition and homogeneity.
This
means that if an input x(t) results in an output y(t), scaling the input by a constant factor results
in a
proportionally scaled output. Additionally, if the system receives a sum of inputs, the output will
be the
sum of the individual responses. Mathematically, this can be represented as:T[ax1(t) + bx2(t)] =
aT[x1(t)]
+ bT[x2(t)]
• Nonlinear Systems:A nonlinear system does not follow the principles of superposition and
homogeneity.
The relationship between input and output may involve squares, products, or other nonlinear
operations,
leading to outputs that do not change proportionally with changes in the input.

2. Time-Invariant and Time-Variant Systems:


• Time-Invariant Systems:A time-invariant system's output does not change if the input signal
is shifted.
If an input x(t) produces an output y(t), then shifting the input by a certain amount t0 will cause
the output
to shift identically:y(t - t0) = T[x(t - t0)]This means the system’s behavior remains consistent
regardless of
when the input is applied.
• Time-Variant Systems:In contrast, the output of a time-variant system changes if the input is
shifted.
The system's characteristics vary over time, meaning its response depends on when the input is
applied.

3. Memory and Memoryless Systems:


• Memoryless Systems:A memoryless system's output at any time depends only on the input
at that
moment, without any reference to past or future inputs. For example:y(t) = x(t)
7
• Memory Systems:A system with memory relies on past (or future) inputs to produce the
current output.
For example:y(t) = x(t - 1)Here, the output at time t depends on the past input.

4. Causal and Noncausal Systems:


• Causal Systems:In a causal system, the output depends only on the present and past inputs
and not on
future inputs. This makes causal systems applicable in real-time scenarios, where future inputs
are not
yet known. For example:y(t) = x(t) + x(t - 1)
• Noncausal Systems:Noncausal systems rely on future input values to determine the present
output. For
example:y(t) = x(t + 1)Since accessing future inputs is often impossible in real-time systems,
noncausal
systems are generally used in theoretical or predictive contexts.

5. Stable and Unstable Systems:


• Stable Systems:A system is considered stable if it satisfies the Bounded Input Bounded
Output (BIBO)
criterion, meaning that for any bounded input (with finite amplitude), the output remains
bounded and
does not diverge over time. For example, if the system receives a sinusoidal input and produces
an
output within a finite range, it is deemed stable.
• Unstable Systems:An unstable system does not satisfy the BIBO stability criterion, meaning
that even
a bounded input can cause the output to grow without limits over time. For instance, if a unit
step input
causes the output to increase indefinitely, the system is classified as unstable.

You might also like