0% found this document useful (0 votes)
20 views18 pages

Sns Lab Report Combined (1-5)

Uploaded by

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

Sns Lab Report Combined (1-5)

Uploaded by

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

NAME: HASSAN IQBAL

ROLL NO: FA20-BEE-071

COMBINED LAB REPORT 1-5

LAB #1 TASKS:
TASK 1:
x=-2:2 % independent variable ,length of the plot
length (x)
y=x.^2 % Function
length (y)
plot(x,y)

TASK 1b:
x=-2:0.01:2 % independent variable ,length of the plot

length (x)
y=x.^2 % Function
length (y)
plot(x,y)
TASK 2:
x = linspace(0,2*pi,100) % linspace could be used to create a vector.

x=0:pi/50:2*pi % this is same value as above. Both method are correct


y = (x.^2).*cos(x);
g = x.*cos(x);
f = (2.^x).*sin(x);
plot(x,y,x,g,x,f)

TASK 3:
x = linspace(0,2*pi,150);
plot(x,cos(x),'r*',x,sin(x),'k')
xlabel('Time Axis')
ylabel('Amplitude')
title('Graph of cos(x) & sin(x)')
legend('cos','sine')

TASK 2b:
x = linspace(0,2*pi,150);
subplot(211)
plot(x,cos(x),'r*')
xlabel('Time Axis')
title('Graph of cos(x)')
subplot(212)
plot(x,sin(x),'k')
ylabel('Amplitude')
title('Graph of sin(x)')
legend('cos','sine')
TASK 5:
n = -3:3

f= n.^2
stem(n,f)
xlabel('Time Axis')
ylabel('Amplitude')
title('Graph of f(n)')

TASK 6:

t1=-2:.1:2;
t2=2.1:.1:4.9;
t3=5:.1:8;
f1=ones(size(t1));
f2=zeros(size(t2));
f3=t3.*sin(4*pi*t3);
t=[t1 t2 t3];
f=[f1 f2 f3];
plot(t,f)
title('Multi-part function f(t)')
xlabel( 'time')
ylabel( 'Amplitude')

__________LAB #2:
TASK 1:
clc

clear
clear all
n=-5:0.1:5;
x=cos(n);
plot(n,x)
title('çosine function')
xlabel('time')
ylabel('Amplitude')

TASK 2b:
clc
clear
clear all
n=-5:0.01:5;
x=cos(n);
stem(n,x)
title('çosine function')
xlabel('time')
ylabel('Amplitude')

TASK 4:
clc

clear
clear all
t=0:0.01:8/3
x=3*cos(3*pi*t+pi/3)
plot(t,x)
title('signal in four periods')
xlabel('time')
ylabel('amplitude')

TASK 5:
clc

clear
clear all
t=-10:0.1:10
x1=cos(t)
x2=sin(t+pi/2)
plot(t,x1,'R',t,x2,'G')
title('shifted time signal')
xlabel('time')
ylabel('amplitude')

TASK 6:
clc

clear
clear all
A=71
T=A/2
t=-5:0.01:5;
B_1=(A/100);
B_2=(-A/100);
x_t=A*exp(B_1.*t);
y_t=A*exp(B_2.*t);
plot(t,x_t,'g',t,y_t,'*c')
title('exponential signal')
legend('Growing','Exponential')
xlabel('time')
ylabel('amplitude')

TASK 7:
clc

clear
clear all
T=2
t=0:0.1:2
y_re=real(2*exp(j*pi*t+pi/3));
y_img=imag(2*exp(j*pi*t+pi/3));
plot(t,y_re,'*r',t,y_img,'-.');
legend('real','imaginary')

TASK 8:
clc

clear
clear all
t=-5:0.1:5
x=dirac(t)
y=x==inf
plot(t,y)

_______ LAB #3:

TASK 1:
clc

close all
clear
t = -10:0.01:10 ;
xt = sin(t) ;
plot(t,xt) ;
TASK 2:
clc

close all
clear
t= 0:0.1:(6*pi);
x= cos(t)+ sin(3*t);
plot(t,x)

TASK 3:
clc
close all
clear

%Causal
t1=-10:0;
t2=0:10;
t=[t1 t2];
x= zeros (size(t1));
y= ones (size(t2));
z= [x y];
subplot 221
stem(t ,z,'r');
title('Causal');

%non-causal
n1= -10:0;
n2= 0:10;
n = [n1 n2];
x1= ones (size(n1));
x2= ones(size(n2));
z2=[ x1 x2];
subplot 222
stem(n,z2);
title('Non Causal');
clc
close all
clear
%Anti causal
t1=-5:0;
t2=0:5;
t=[t1 t2];
x3 =ones (size(t1));
x4 =zeros (size(t2));
z3 =[ x3 x4 ];
subplot 221
stem (t,z3);

title('Anti causal');
TASK 4:
clc
close all
clear
t= -10:0.1:10;
xt= sin((pi*t)+2)+ cos((2*pi*t/3)+1);
stem(t,xt);
xlabel('Time');
ylabel('Amplitude');
axis([0 2 -2 2]);
TASK 5:
clc

close all
clear
n= 0:2*pi;
x= sin((pi*n)+2);
y= cos((2*n/3) +1);
z= x+y;
stem(n,z,'r');
xlabel('Time');
ylabel('Amplitude');
TASK 6:
clc

close all
clear
t= -5: 0.1: 5;

x = t.^2;
y = t.^3;
subplot 211
%Even
plot(t,x);
xlabel('Time');
ylabel('Amplitude');
subplot 212
%Odd
plot(t,y);
xlabel('Time');
ylabel('Amplitude');
TASK 7:
clc

close all
clear
t= -3:3;
x1= heaviside(t);
x2= heaviside(-t);
x3= (x1+x2)/2;
x4= (x1-x2)/2;

x= x3 + x4;
%original form
subplot 221
stem (t,x1);
title('Orignal');
xlabel('Time');
ylabel('Amplitude');
%even
subplot 222
stem(t,x3);
title('even');
xlabel('Time');
ylabel('Amplitude');
%odd
subplot 223
stem(t,x4);
title('odd');
xlabel('Time');
TASK 8:
clc

close all
clear
t=-5:0.1:10;
y=2*cos(pi*t);
energy=((norm(y))^2);
sprintf('energy %d',energy)

pow=(norm(abs(y)).^2)./(1*y);
sprintf('power %d',pow)
plot(energy,'r');
hold on
plot(pow,'b');
TASK 9:
clc

close all
clear
t=-71:0.1:71;
y=(t);
energy=((norm(y))^2);
sprintf('energy %d',energy)
stem(energy)

TASK 10:

clc

close all
clear
t= -1:0.1:3;
x= t.*exp(-t);
plot(-t,x);
xlabel('Time');
ylabel('Amplitude');
title('x(-t)');
TASK 11:
clc

close all
clear
t= -1:0.1:3;
x= t.*exp(-t);
subplot 221
plot(t,x);
title('Orignal Signal');
subplot 222
plot(t/2,x);
title('Compression');
subplot 223
plot(2*t,x);
title('Expansion');
TASK 12:
clc

close all
clear
t= -1:0.1:3;
x= t.*exp(-t);
subplot 221
plot(t,x);
title('Orignal Signal');
t1= t+2;
subplot 222
plot(t1,x);
title('Shifted right');
t3= t-3;
subplot 223
plot(t3,x);
title('Shifted left');

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