0% found this document useful (0 votes)
70 views

Signal System Matlab

Here are the key steps to determine the magnitude and phase response of a Fourier transform: 1. Given a continuous time signal x(t), take its Fourier transform X(jω) using the definition: X(jω) = ∫−∞∞ x(t)e-jωt dt 2. The magnitude response |X(jω)| is given by the absolute value of the Fourier transform: |X(jω)| = √[Re{X(jω)}]2 + [Im{X(jω)}]2 3. The phase response ∠X(jω) is given by the argument (angle) of the Fourier transform

Uploaded by

Ritik Gupta
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
70 views

Signal System Matlab

Here are the key steps to determine the magnitude and phase response of a Fourier transform: 1. Given a continuous time signal x(t), take its Fourier transform X(jω) using the definition: X(jω) = ∫−∞∞ x(t)e-jωt dt 2. The magnitude response |X(jω)| is given by the absolute value of the Fourier transform: |X(jω)| = √[Re{X(jω)}]2 + [Im{X(jω)}]2 3. The phase response ∠X(jω) is given by the argument (angle) of the Fourier transform

Uploaded by

Ritik Gupta
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 15

EXPERIMENT NO.

1
Aim:- To plot continuous time signal encountered in signal processin like sine
square ,sawtooth ,exponential sequences using matlab.

Matlab code
1.Sinusoidal wave form
clc;
clear all;
close all;
T=2;
t=2:0.1:10;
x1=sin((2*pi*t)/T);
subplot(3,2,1),plot(x1);
xlabel('t'),ylabel('x1');
tilte('sinusoidal waveform');

2.square wave form


clc;
clear all;
close all;
t1=10:0.01:20;
x2=square(t1)
plot(x2)
xlabel('t2'),ylabel('x2')
tilte('square waveform')
3.sawtooth waveform
clc;
clear all;
close all;
t1=10:.01:30;
t=2:.01:10;
x=sawtooth(t1);
plot(x);
xlabel('t'),ylabel('x');
titlte('sawtooth waveform');

4.Exponential waveform
clc;
clear all;
close all;
t1=5:.01:10;
x=exp(t1);
plot(x);
xlabel('t'),ylabel('x');
titlte('exponenetial waveform');

5.cosine waveform
clc;
clear all;
close all;
T=2;
t=2:0.1:10;
x1=cos((2*pi*t)/T);
subplot(3,2,1),plot(x1);
xlabel('t'),ylabel('x1');
tilte('sinusoidal waveform');

sinusoidal waveform
1

0.8

0.6

0.4

0.2
x1

-0.2

-0.4

-0.6

-0.8

-1
0 10 20 30 40 50 60 70 80 90
t

Square waveform
1

0.8

0.6

0.4

0.2
x2

-0.2

-0.4

-0.6

-0.8

-1
0 200 400 600 800 1000 1200
t2
Sawtooth waveform
1

0.8

0.6

0.4

0.2

0
x

-0.2

-0.4

-0.6

-0.8

-1
0 500 1000 1500 2000 2500
t

Exponential waveform
4
x 10
2.5

1.5
x

0.5

0
0 100 200 300 400 500 600
t

Cosine waveform
1

0.8

0.6

0.4

0.2
x1

-0.2

-0.4

-0.6

-0.8

-1
0 10 20 30 40 50 60 70 80 90
t
Experiment no. 2
Object:- To plot discrete time signals encountered in signal processing like unit impulse,
Unit step, ramp and exponential sequences using MATLAB.

Matlab Code:-

1. Unit Impulse Function 2. Unit Step Function


clc; clc;
close all; close all;
clear all; clear all;
m=-4:1:4; N=21;
x1=[zeros(1,4),1,zeros(1,4)]; x2=ones(1,N);
subplot(2,2,1);stem(m,x1); n=0:1:N-1;
xlabel('n'),yalabel('x1'); subplot(2,2,2),stem(n,x2);
title('Unit Impulse Function') xlabel('n'),ylabel('x2');
title('Unit Step Function')

3. Ramp Function 4. Exponential Function


clc; clc;
close all; close all;
clear all; clear all;
m=0:1:10; n=-4:1:4;
x3=m; x4=0.6.^n;
subplot(2,2,3);stem(m,x3); subplot(2,2,4),stem(n,x4);
xlabel('n'),yalabel('x3'); xlabel('n'),ylabel('x4');
title('Ramp Function') title('Exponential Function')
Output / Result:-
EXPERIMENT NO. 3
Object:- To explore the commutation of even and odd symmetry in a signal with
algebraic
operations.

Theory:- Even and odd signals bear some important symmetrical properties,
under
reversal of independent variable, these signal remains the same (even) or
get reflected or flipped (odd signal) about the horizontal axis, equation
5.1 and 5.2 reveled the both continuous and discrete time cases.

Even Signals: x(t) = x(-t), x[n] = x[-n]


Odd Signals: x(t) = -x(-t), x[n] = -x[-n]

Here we are discussing about discrete time signal.

Matlab Code:-

clc;
close all;
clear all;
n=-3:3;
xn=[0 0 0 1 1 1 1];
xN=fliplr(xn);
xe=(xn+xN)/2;
xo=(xn-xN)/2;
subplot(3,1,1);stem(n,xn);axis([-4 4 -1 1.5])
grid;ylabel('x[n]')
title('demonstration of even odd decomposition')
subplot(3,1,2);stem(n,xe);axis([-4 4 -1 1.5])
grid;ylabel('xe[n]')
subplot(3,1,3);stem(n,xo);axis([-4 4 -1 1.5])
grid;ylabel('xo[n]');xlabel('n')
Output/ Result:
Experiment no. 4
Object:- To explore the effect of transformation of signal parameters (time
shifting and time scalling)

Matlab Code:-
Time Shifting
clc;
clear all;
close all;
n=0:20;
xn=[0 1 2 3 4 5 6 7 8 9 10 9 8 7 6 5 4 3 2 1 0];
subplot(2,1,1);stem(n,xn);axis([-1 26 0 11])
xlabel('n');ylabel('x[n]');title('x[n]versus n')
subplot(2,1,2);stem(n+5,xn);axis([-1 26 0 11])
xlabel('n');ylabel('x[n]');title('x[n-5]versus n')

Time Scalling

clc;
clear all;
close all;
n=0:20;
xn=[0 1 2 3 4 5 6 7 8 9 10 9 8 7 6 5 4 3 2 1 0];
nnew=0:40;
yn=zeros(1,41);
yn(1:2:41)=xn;
subplot(2,1,1);stem(n,xn);axis([-2 42 -1 11])
xlabel('n');ylabel('x[n]');
subplot(2,1,2);stem(nnew,yn);axis([-2 42 -1 11])
xlabel('nnew');ylabel('x[n]');
Output/ Result:- Time Shifting

Time Scalling
EXPERIMENT NO. 5

Object:-
Find out the circular convolution y (n) of two given sequences:-
1. x(n) = [10 20 30 40 50 60] and
2. h(n) = [5 6 7 8 9 10] .

Matlab Code :-

clc;
clear all;
close all;
x=[10 20 30 40 50 60];
h=[5 6 7 8 9 10];
nx=(0:1:5);
nh=(0:1:5);
subplot(3,1,1);stem(nx,x);
xlabel('n');ylabel('x[n]');
subplot(3,1,2);stem(nh,h);
xlabel('n');ylabel('h[n]');
n=(0:1:length(x)+length(h)-2); %total length of colum start from 0 with interval
1 and up to length of sequence x which is 06 here and length of sequence h
which is 6
%here - 2 = 04 total 10
subplot(3,1,3);
c=conv(x,h);
stem(n,c,'k');
xlabel('n');ylabel('x[n]');
title('circular convolution of wo sequences');
Output/ Result:-
EXPERIMENT NO. 6
Object:- 1.To explore the causality and non causality of the system.

1. For the given rational form transfer function (�)=2+16 �−1+44 �−2+56 �−3+32
�−4/3+3 �−1−15 �−2+18 �−3−12 �−4

a. Determine location of poles and zeroes and convert into factored form.
b. Plot pole-zero diagram.
c. Find the possible ROCs and discuss the stability of the system.

Matlab Code :-
Z = 2S4 + 16S3 + 44S2 + 56S + 32
----------------------------------------
3S4 + 3S3 - 15S2 + 18S – 12

1. clc;
clear all;
n=[2,16,44,56,32];
d=[3,3,-15,18,-12];
sys=tf(n,d)

2.
clc;
clear all;
num=[2,16,44,56,32];
den=[3,3,-15,18,-12];
[z, p, k] = tf2zp (num, den)
zplane(num,den)
title('pole zero plot')
Result:-
z=
-4.0000 + 0.0000i
-2.0000 + 0.0000i
-1.0000 + 1.0000i
-1.0000 - 1.0000i
p=
-3.2361 + 0.0000i
1.2361 + 0.0000i
0.5000 + 0.8660i
0.5000 - 0.8660i
k=0.6667
Factored Form:-
�(�)=0.667(1+4 �−1)(1+2 �−1)(1+(1−�) �−1)(1+(1+�) �−1)(1+3.236 �−1)(1−1.236
�−1)(1−(0.5+0.866�) �−1)(1−(0.5−0.866�) �−1)
Possible ROC’s and Stability of the system will be:-
1. |z| < 1 The system will be unstable, since it will not include the unit circle.
2. 1 < |z| < 1.236 The system will be unstable, since it will not include the unit circle.
3. 1.236 < |z| < 3.236 The system will be unstable, since it will not include the unit
circle.
4. |z| > 3.236 The system will be unstable, since it will not include the unit circle.

OUTPUT:-
Experiment no. 7
Object:- To determine the magnitude and phase response of Fourier transform of
given signal.

Matlab Code :-

clc;
clear all;
close all;
t=-1.5:0.005:1.5;
xsin=sin(2*pi*t);
xt=xsin>0;
k=-50:50;
T=1;T1=0.25;w0=2*pi/T;t0=0.25;
ak=exp(-j*k*w0*t0).*sin(k*2*pi*(T1/T))./(k*pi);
ak(51)=2*T1/T;
bk=fliplr(ak);
xtr=zeros(1,length(t));
for k=-50:50
xtr=xtr+ ak(k+51)*exp(j*k*w0*t);
end
yt=zeros(1,length(t));
for k=-50:50
yt=yt+ bk(k+51)*exp(j*k*w0*t);
end

figure(1);set(gcf,'defaultaxesfontsize',8)
subplot(3,1,1);plot(t,xt);ylabel('x(t)')
title('periodic square wave (T=1,T1=0.25)')
set(gca,'ylim',[-0.2 1.2]);grid

subplot(3,1,2);plot(t,xtr);ylabel('x(t)')
title('periodic square wave reconstructed from its FS')
set(gca,'ylim',[-0.2 1.2]);grid;

subplot(3,1,3);plot(t,real(yt))
xlabel('t');ylabel('y(t)=x(-t)')
title('reconstruction from bk''s with 101 terms')
set(gca,'ylim',[-0.2 1.2]);grid
Output/ Result:-

You might also like