Sie sind auf Seite 1von 18

SIGNALS ANALYSIS AND PROCESSING

LAB TASK 2

NAME-D.V.SAHITHI

REGNO-18BEC2011

FACULTY-PROF. DEEPA MADATHIL

SLOT-L-33+L-34

1. Generate two input signals and two sequences and perform the
following basic operations on them: addition, multiplication,
scaling, shifting and folding. Also compute their energy and
power.
clc;
clear all;
close all;
t=-1:0.01:1;
y1=sin(2*pi*t);
y2=sin(2*pi*2*t);
y3=y1+y2;
y4=y1.*y2;
figure
subplot(2,2,1);
plot(t,y1);
xlabel('time');
ylabel('amplitude');
title('sin(2*pi*t');
subplot(2,2,2);
plot(t,y2);
xlabel('time');
ylabel('amplitude');
title('sin(2*pi*2*t');
subplot(2,2,3);
plot(t,y3);
xlabel('time');
ylabel('amplitude');
title('sum');
subplot(2,2,4);
plot(t,y4);
xlabel('time');
ylabel('amplitude');
title('multiply');
figure;
subplot(2,2,1);
stem(t,y1);
xlabel('time');
ylabel('amplitude');
title('seq of y1');
subplot(2,2,2);
stem(t,y2);
xlabel('time');
ylabel('amplitude');
title('seq of y2');
subplot(2,2,3);
stem(t,y3);
xlabel('time');
ylabel('amplitude');
title('seq of y3');
subplot(2,2,4);
stem(t,y4);
xlabel('time');
ylabel('amplitude');
title('seq of y4');
y5=5*y1;
y6=y1;
y7=y1;
figure;
subplot(2,2,1);
plot(t,y5);
xlabel('time');
ylabel('amplitude');
title('amplitude scaling');
subplot(2,2,2);
plot(-t,y6);
xlabel('time');
ylabel('amplitude');
title('time reversing');
subplot(2,2,3);
plot((t-2),y7);
xlabel('time');
ylabel('amplitude');
title('time shifiting');
figure;
subplot(2,2,1);
stem(t,y5);
xlabel('time');
ylabel('amplitude');
title('seq of amplitude scaling');
subplot(2,2,2);
stem(-t,y6);
xlabel('time');
ylabel('amplitude');
title('seq of time reversing');
subplot(2,2,3);
stem((t-2),y7);
xlabel('time');
ylabel('amplitude');
title('seq of time shifiting');

i=input('enter the signal : ');


energy=sum(abs(i.^2))
power=energy/length(i)
2. Determine the even and odd parts of a signal and a
sequence.

clc
clear all;
close all;
t=-1:0.01:1;
y=sin(2*pi*t);
z=sin(2*pi*(-t));
xe=(y+z)/2;
xo=(y-z)/2;
figure;
subplot(2,2,1);
plot(t,y);
xlabel('time');
ylabel('amplitude');
title('sin(2*pi*t)');
subplot(2,2,2);
plot(t,z);
xlabel('time');
ylabel('amplitude');
title('sin(2*pi*(-t))');
subplot(2,2,3);
plot(t,xe);
xlabel('time');
ylabel('amplitude');
title('even parts');
subplot(2,2,4);
plot(t,xo);
xlabel('time');
ylabel('amplitude');
title('odd parts');
figure;
subplot(2,2,1);
stem(t,y);
xlabel('time');
ylabel('amplitude');
title('sin(2*pi*t)');
subplot(2,2,2);
stem(t,z);
xlabel('time');
ylabel('amplitude');
title('sin(2*pi*(-t))');
subplot(2,2,3);
stem(t,xe);
xlabel('time');
ylabel('amplitude');
title('even parts');
subplot(2,2,4);
stem(t,xo);
xlabel('time');
ylabel('amplitude');
title('odd parts');

a=[-2 -3 1 5 -5 8 9];
n=-3:3;
b=fliplr(a);
c=(a+b)/2;
d=(a-b)/2;
figure;
subplot(2,2,1);
plot(n,a);
xlabel('time intervals');
ylabel('amplitude');
title('signal 1');
subplot(2,2,2);
plot(n,b);
xlabel('time intervals');
ylabel('amplitude');
title('neg of signal 1');
subplot(2,2,3);
plot(n,c);
xlabel('time intervals');
ylabel('amplitude');
title('even parts ');
subplot(2,2,4);
plot(n,d);
xlabel('time intervals');
ylabel('amplitude');
title('odd parts');
figure;
subplot(2,2,1);
stem(n,a);
xlabel('time intervals');
ylabel('amplitude');
title('signal 1');
subplot(2,2,2);
stem(n,b);
xlabel('time intervals');
ylabel('amplitude');
title('neg of signal 1');
subplot(2,2,3);
stem(n,c);
xlabel('time intervals');
ylabel('amplitude');
title('even parts ');
subplot(2,2,4);
stem(n,d);
xlabel('time intervals');
ylabel('amplitude');
title('odd parts');
3) find the real and imaginary parts of a complex signal.
clc
clear all;
close all;
t=-10:0.01:10;
y=sin(t)+j*cos(t);
figure;
subplot(2,2,1);
plot(t,y);
xlabel('time');
ylabel('amplitude');
title('signal');
subplot(2,2,2);
plot(t,real(y));
xlabel('time');
ylabel('amplitude');
title('real parts');
subplot(2,2,3);
plot(t,imag(y));
xlabel('time');
ylabel('amplitude');
title('complex parts');
figure;
subplot(2,2,1);
stem(t,y);
xlabel('time');
ylabel('amplitude');
title('signal');
subplot(2,2,2);
stem(t,real(y));
xlabel('time');
ylabel('amplitude');
title('real parts');
subplot(2,2,3);
stem(t,imag(y));
xlabel('time');
ylabel('amplitude');
title('complex parts');

Das könnte Ihnen auch gefallen