Professional Documents
Culture Documents
Jatin Katiyar Signals and Systems Lab
Jatin Katiyar Signals and Systems Lab
NO 6-7
JATIN KATIYAR
19A017
JATIN KATIYAR 191A017
[191𝐴017]
CODE
191A017
JATIN KATIYAR 191A017
d_sin=[];d_cos=[];
for n=1:2:N %For EFS range is –N to N with suitable
interval
an=-4/(n^2*pi); %Cosine coefficients
bn=0; %Sine coefficients
a_cos = an*cos(n*w0*t); %Cosine components
b_sin = bn*sin(n*w0*t); %Sine components
d_cos = [d_cos;a_cos];
d_sin = [d_sin;b_sin];
end
x=a0+sum(d_cos)+sum(d_sin); %Fourier series for signal x(t)
subplot(333)
plot(t,d_cos) %Plot for cosine components
xlabel('time t --->')
ylabel('Amplitude --->')
title('Cosine components of waveforms')
subplot(336)
plot(t,d_sin) %Plot for sine components
xlabel('time t --->')
ylabel('Amplitude --->')
title('Sine components of waveforms')
subplot(339)
plot(t,x) %Plot for waveform
xlabel('time t --->')
ylabel('Amplitude --->')
title('Synthesized waveform using Fourier series');
ANS
GRAPH
[191𝐴017]
191A017
JATIN KATIYAR 191A017
CODE
191A017
JATIN KATIYAR 191A017
w0=1;
d_sin=[];d_cos=[];
for n=1:2:N %For EFS range is –N to N with suitable
interval
an=(1-exp(-2*pi))/((n^2+1)*pi); %Cosine coefficients
bn=((1-exp(-2*pi))*n)/((n^2+1)*pi); %Sine coefficients
a_cos = an*cos(n*w0*t); %Cosine components
b_sin = bn*sin(n*w0*t); %Sine components
d_cos = [d_cos;a_cos];
d_sin = [d_sin;b_sin];
[191𝐴017]
end
x=a0+sum(d_cos)+sum(d_sin); %Fourier series for signal x(t)
subplot(333)
plot(t,d_cos) %Plot for cosine components
xlabel('time t --->')
ylabel('Amplitude --->')
title('Cosine components of waveforms')
subplot(336)
plot(t,d_sin) %Plot for sine components
xlabel('time t --->')
ylabel('Amplitude --->')
title('Sine components of waveforms')
subplot(339)
plot(t,x) %Plot for waveform
xlabel('time t --->')
ylabel('Amplitude --->')
title('Synthesized waveform using Fourier series');
ANS
GRAPH
[191𝐴017]
191A017
JATIN KATIYAR 191A017
CODE
191A017
JATIN KATIYAR 191A017
subplot(333)
plot(t,d_cos) %Plot for cosine components
xlabel('time t --->')
ylabel('Amplitude --->')
title('Cosine components of waveforms')
subplot(336)
plot(t,d_sin) %Plot for sine components
xlabel('time t --->')
ylabel('Amplitude --->')
title('Sine components of waveforms')
subplot(339)
plot(t,x) %Plot for waveform
xlabel('time t --->')
ylabel('Amplitude --->')
title('Synthesized waveform using Fourier series');
ANS
GRAPH
[191𝐴017]
191A017
JATIN KATIYAR 191A017
[191𝐴017]
CODE
191A017
JATIN KATIYAR 191A017
subplot(333)
plot(t,d_cos) %Plot for cosine components
xlabel('time t --->')
ylabel('Amplitude --->')
title('Cosine components of waveforms')
subplot(336)
plot(t,d_sin) %Plot for sine components
xlabel('time t --->')
ylabel('Amplitude --->')
title('Sine components of waveforms')
subplot(339)
plot(t,x) %Plot for waveform
xlabel('time t --->')
ylabel('Amplitude --->')
title('Synthesized waveform using Fourier series');
ANS
191A017
JATIN KATIYAR 191A017
GRAPH
[191𝐴017]
191A017
JATIN KATIYAR 191A017
CODE
clc;
clear all;
N=100;
T=10;
t=0:0.001:3*T;
w0=(2*pi)/T;
d_exp=[];
for n=-N:1:N
cn=1/((n+eps)*pi)*(sin(n*pi/5)*exp((-j*n*pi)/5));
c_exp=cn*exp(j*w0*n*t);
d_exp=[d_exp;c_exp];
end
c0=1/5;
x=c0+sum(d_exp);
subplot(2,1,1);
plot(t,d_exp);
xlabel('time t---->');
ylabel('amplitude');
title('component of wave');
subplot(2,1,2);
plot(t,x);
xlabel('time t---->');
ylabel('amplitude');
title('component of x');
[191𝐴017]
ANS
GRAPH
191A017
JATIN KATIYAR 191A017
[191𝐴017]
191A017
JATIN KATIYAR 191A017
[191𝐴017]
CODE
syms t s;
h=exp(-2*t)+2*t*exp(-t)-exp(-t);
x1=laplace(h,t,s)
y=simplify(x1)
ANS
nuntitled2
x1 =
191A017
JATIN KATIYAR 191A017
y =
N=[1,3];
D=[1,4,5,2];
roots(N)
[191𝐴017]
ans =
-3
roots(D)
ans =
-2.0000 + 0.0000i
-1.0000 + 0.0000i
-1.0000 - 0.0000i
pzmap(roots(D),roots(N))
stable
GRAPH
191A017
JATIN KATIYAR 191A017
CODE
syms t s
x=((s+3)/s^3+5*s^2+12*s+8);
ilaplace(x)
simplify(x)
N=[1,3]; %Numerator coefficients
D=[1,5,12,8]; %denominator coefficients
[r, p, k]=residue(N, D)
factor(s^3+5*s^2+12*s+8)
ANS
nuntitled2
ans =
ans =
r =
-0.2000 - 0.1500i
-0.2000 + 0.1500i
0.4000 + 0.0000i
p =
-2.0000 + 2.0000i
-2.0000 - 2.0000i
-1.0000 + 0.0000i
k =
[]
ans =
[s + 1, s^2 + 4*s + 8]
191A017
JATIN KATIYAR 191A017
CODE
yms t s
x=((s^3+8*s^2+24*s+32)/(s^2+6*s+8));
ilaplace(x)
[191𝐴017]
simplify(x)
N=[1,3]; %Numerator coefficients
D=[1,5,12,8]; %denominator coefficients
[r, p, k]=residue(N, D)
factor((s^2+6*s+8))
roots(N)
roots(D)
% Pole-zero diagram/map
pzmap(roots(D),roots(N))
ANS
nuntitled2
ans =
ans =
r =
-0.2000 - 0.1500i
-0.2000 + 0.1500i
0.4000 + 0.0000i
p =
-2.0000 + 2.0000i
-2.0000 - 2.0000i
-1.0000 + 0.0000i
k =
191A017
JATIN KATIYAR 191A017
[]
ans =
[s + 4, s + 2]
ans =
-3
ans =
-2.0000 + 2.0000i
-2.0000 - 2.0000i
-1.0000 + 0.0000i
GRAPH
191A017
JATIN KATIYAR 191A017
CODE
% Fourier transform
syms t w
tau = 1;
trig =triangularPulse(t) % generation of tri(t/2tau)
trig_FT = fourier(trig) % Fourier Transform rect(t/tau)
t_v= (-3:0.01:3);
trig_t = subs(trig, t, t_v+eps);
% subs( ) to get the numericaltrig(t/2tau)
subplot(2,1,1);
plot(t_v, trig_t); % plot of rectangular pulse
axis([-3 3 -0.1 1.1]);
xlabel('t sec');ylabel('x(t)');
title('triangular Pulse of width 2')
w_v = (-20:0.01:20);
trig_w = subs(trig_FT, w, w_v+eps);
%subs()to get the numerical value of FT
subplot(2, 1, 2);
plot(w_v, abs(trig_w), w_v, angle(trig_w) );%magnitude and phase spectrum
legend('Magnitude spectrum','Phase spectrum')
xlabel('\omega (rad/s)');ylabel('X(\omega)')
title('Sinc Pulse of width 2\pi')
ANS
jatinkatiyaruntitled2
trig_FT =
-(exp(-w*1i)*(exp(w*1i) - 1)^2)/w^2
GRAPH
[191𝐴017]
191A017
JATIN KATIYAR 191A017
subplot(2,1,1);
plot(t_v, trig_t); % plot of rectangular pulse
axis([-3 3 -0.1 1.1]);
xlabel('t sec');ylabel('x(t)');
title('triangular Pulse of width 2')
w_v = (-20:0.01:20);
trig_w = subs(trig_FT, w, w_v+eps);
%subs()to get the numerical value of FT
subplot(2, 1, 2);
plot(w_v, abs(trig_w), w_v, angle(trig_w) );%magnitude and phase spectrum
legend('Magnitude spectrum','Phase spectrum')
xlabel('\omega (rad/s)');ylabel('X(\omega)')
title('Sinc Pulse of width 2\pi')
ANS
jatinkatiyaruntitled2
191A017
JATIN KATIYAR 191A017
trig_FT =
GRAPH
191A017
CODE
[191𝐴017]
syms t w
191A017
JATIN KATIYAR 191A017
x= t*exp(-t^2);
r=5*sinc((5*t)/pi)+10*sinc((10*t)/pi);
X=fourier(x,w)
R=fourier(r,w)
Y=ifourier(X,t)
S=ifourier(R,t)
subplot(2,2,1);
ezplot(X,w);
subplot(2,2,2);
ezplot(Y,t);
subplot(2,2,3);
ezplot(R,w);
Y=ifourier(X,t)
subplot(2,2,4);
ezplot(S,t);
ANS
GRAPH
191A017
SIGNALS AND SYSTEMS
Lab -03
191A017
jatin katiyar
191A017 JATIN KATIYAR
[191𝐴017]
close all;
n=-10:10;
x1=impseq(0,-10,10)+2*impseq(2,-10,10)+3*impseq(-3,-10,10);
x2=impseq(0,-10,10)+2*impseq(2,-10,10)-6*impseq(-2,-
10,10)+8*impseq(7,-10,10)-5*impseq(-5,-10,10);
subplot(2,2,1);
stem(n,x1);grid on;
xlabel('discrete n');
xlabel('discrete signal');
title('exercise 1(a)');
subplot(2,2,2);
stem(n,x2);grid on;
xlabel('discrete n');
xlabel('discrete signal');
title('exercise 1(b)');
191A017
[191𝐴017]
n=-12:12;
x1=stepseq(5,-12,12)-stepseq(11,-12,12)+2*stepseq(-8,-
12,12)-2*stepseq(2,-12,12);
x2=n.^2.*(stepseq(-5,-12,12)-2*stepseq(6,-
12,12))+10*stepseq(0,-12,12)+20*(0.5).^n.*(stepseq(4,-
12,12)-stepseq(10,-12,12));
subplot(2,2,1);
stem(n,x1);grid on;
xlabel('discrete n');
[191𝐴017]
n=-12:12;
x1=-impseq(-1,-12,12)-2*impseq(-2,-12,12)-3*impseq(-3,-
12,12)-4*impseq(-4,-12,12)-5*impseq(-5,-12,12)+impseq(1,-
12,12)+2*impseq(2,-12,12)+3*impseq(3,-12,12)+4*impseq(4,-
12,12)+5*impseq(5,-12,12);
subplot(2,2,1);
stem(n,x1);grid on; 191A017
xlabel('discrete n');
xlabel('discrete signal');
title('exercise 3)');
% subplot(2,2,2);
% stem(n,x2);grid on;
% xlabel('discrete n');
% xlabel('discrete signal');
% title('exercise 1(b)');
n=-12:12;
x1=impseq(-8,-12,12)+impseq(-7,-12,12)+impseq(-6,-
12,12)+impseq(-5,-12,12)+impseq(-4,-12,12)+impseq(-3,-
12,12)+2*impseq(-2,-12,12)+3*impseq(-1,-12,12)+4*impseq(0,-
12,12)+3*impseq(1,-12,12)+2*impseq(2,-12,12)+impseq(3,-
12,12)+impseq(4,-12,12)+impseq(5,-12,12)+impseq(6,-
12,12)+impseq(7,-12,12)+impseq(8,-12,12);
x2=stepseq(-8,-12,12)+stepseq(-2,-12,12)+stepseq(-1,-
12,12)+stepseq(0,-12,12)-stepseq(1,-12,12)-stepseq(2,-
12,12)-stepseq(3,-12,12)-stepseq(9,-12,12);
subplot(2,2,1);
stem(n,x1,'r');grid on;
xlabel('distance time n');
xlabel('discrete signal');
title('exercise 4');
% subplot(2,2,2);
hold on;
stem(n,x2,'g');grid on;
legend('x1','x2');
xlabel('discrete n'); 191A017
xlabel('discrete signal');
title('exercise 1(b)');
subplot(2,2,3);
stem(n,x1,'r');grid on;
xlabel('distance time n');
xlabel('discrete signal');
title('exercise 4');
subplot(3,3,1);
close all;
n=-30:30;
x1=n.*stepseq(10,-30,30)-n.*stepseq(0,-30,30);
x2=15*(exp(-n+10).*(n.*stepseq(10,-30,30)-n.*stepseq(20,-
30,30) );
x3=20*cos(0.1*pi*n).*(n.*stepseq(20,-30,30)-n.*stepseq(30,-
30,30) );
plot(n,x1);grid on;
xlabel('time n');
ylabel('discrete signal');
title('exercise 5)');
hold on;
plot(n,x1);grid on;
xlabel('time n');
ylabel('discrete signal');
title('exercise 5');
hold on;
plot(n,x1);grid on;
xlabel('time n ');
ylabel('discrete signal');
title('exercise 5');
hold on;
legend('x1','x2','x3');
[191𝐴017]
Code
(a)close all;
clc;
t=0:0.01:0.99;
y=4*cos((5*pi*t)-(pi/4));
plot(t,y)
xlabel('continous time t');
[191𝐴017]
ylabel('amplitude');
title('cosine function','fontsize',12)
(b)t=-1.5:(3.5/99):2;
y=cos(4*t)-2*sin(8*t);
plot(t,y);
xlabel('continous time t');
ylabel('amplitude');
[191𝐴017]
(a)n=linspace(0,1,100);
y=4*cos(0.1*n*pi);
grid on;
stem(n,y);
xlabel('discrete plot');
ylabel('amplitude');
title('cosine plot','fontsize',12);
[191𝐴017]
(b)
t=linspace(0,0.99,100);
w=linspace(-10,10,100);
y=5*exp(-j*w.*t);
y1=real(y);
y2=imag(y);
subplot(2,2,1);
plot(t,y1,t,y2);
grid on;
xlabel('continuoes time t');
ylabel('Amplitude');
title('Exponential Function')
legend('y2 Imagenary','y1 real');
subplot(2,2,2);
plot3(t,w,y); grid on;
xlabel('continuoes time t');
ylabel('Amplitude');
title('3-d Exponential Function')
[191𝐴017]
t=-1:6/599:5;
y=(exp(-2*t)).*(cos(6*pi*t));
%subplot(2,2,1);
figure(1);
plot(t,y);
xlabel('t sec');
ylabel('f(t) volts');
axis([-2, 7, -10, 10]);
n=-1:6/599:5;
y=(exp(-2*n)).*(cos(6*pi*n));
%subplot(2,2,2);
figure(2);
stem(t,y);
xlabel('t sec');
ylabel('f(t) volts');
axis([-2, 7, -10, 10]);
[191𝐴017]
t=-1:6/599:5;
y=(exp(-2*t)).*(cos(6*pi*t));
subplot(2,2,1);
% figure(1);
plot(t,y);
xlabel('t sec');
ylabel('f(t) volts');
axis([-2, 7, -10, 10]);
title('difference between plot and stem');
n=-1:6/599:5;
y=(exp(-2*n)).*(cos(6*pi*n));
subplot(2,2,2);
% figure(2);
stem(t,y);
xlabel('t sec');
ylabel('f(t) volts');
axis([-2, 7, -10, 10]);
[191𝐴017]
t1=-8:-3;
x1=0+t1*0;
t2=-4:2;
x2=(t2+2)+t2*0;
t3=3:8;
x3=(t3-2)+t3*0;
t=[t1 t2 t3];
x=[x1 x2 x3];
plot(t,x)
xlabel('t sec');
ylabel('x(t) volts');
title('exercise 4');
[191𝐴017]
n1=-8:-3;
x1=0+n1*0;
n2=-4:2;
x2=(n2+2)+n2*0;
n3=3:8;
x3=(n3-2)+n3*0;
n=[n1 n2 n3];
x=[x1 x2 x3];
stem(n,x)
xlabel('n sec');
ylabel('x(n) volts');
title('exercise 4');
[191𝐴017]
t1=0:10;
x1=-20+4*t;
t2=10:20;
x2=20+t2*0;
t3=20:23;
x3= 9.74.*10^9.*exp(-t3)+t3*0;
x=[x1,x2,x3];
t=[t1 t2 t3];
plot(t,x);grid on;
xlabel('time');
ylabel('continous signal');
axis([-3 30 -5 30]);
191A017
JATIN KATIYAR
191A017 JATIN KATIYAR
[191𝐴017]
subplot(3,2,4);
x4=sigfold(-2*x3,n);
stem(n+1,x4);grid on;
signfold.m function
function [y,n]=sigfold(x,m);
n=-fliplr(m);
[191𝐴017]
y=fliplr(x);
signshift.m function
function [y,n]=sigshift(x,m,k);
n=m+k;
y=x;
graph
Code
n=-2:10;
x=[1,2,3,4,5,6,7,6,5,4,3,2,1];
subplot(2,2,1);
stem(n,x);
xlabel('discrete n');
ylabel('amplitude in discrete');
title('plot of x function');
x1=sigshift(2*x,n,5);
x2=sigshift(3*x,n,-4);
n1=3:15;
[191𝐴017]
n2=-6:6;
n3=-6:15;
x3= sigadd(x1,n1,x2,n2);
subplot(2,2,2);
stem(n3,x3);grid on;
xlabel('discrete n');
ylabel('amplitude in discrete');
title('plot of y function');
function sigadd.m
function [y,n]= sigadd(x1,n1,x2,n2);
m1=min(min(n1),min(n2));
m2=max(max(n1),max(n2));
n=m1:m2;
y1=[zeros(1,abs(min(n1)-m1)) x1 zeros(1,abs(max(n1)-m2))];
y2=[zeros(1,abs(min(n2)-m1)) x2 zeros(1,abs(max(n2)-m2))];
y=y1-y2;
graph
[191𝐴017]
Code
n=-4:8;
x=[1,2,3,4,5,6,7,6,5,4,3,2,1];
subplot(2,2,1);
stem(n,x);
xlabel('discrete n');
ylabel('amplitude in discrete');
title('plot of x function');
n1=-5:7;
n2=-2:10;
x1=sigshift(x,n,2);
x2=sigshift(x,n,-3);
x3=sigfold(x2,n1);
x4=x1.*x;
subplot(2,2,2);
stem(n2,x4);
xlabel('discrete n');
ylabel('amplitude in discrete');
title('plot of x4 function');
n4=-2:8;
x5=sigadd(x2,n1,x4,n2);
n3=-5:10;
subplot(2,2,3);
stem(n3,x5);
grid on;
xlabel('discrete n');
ylabel('amplitude in discrete');
title('plot of y function');
Function
Graph
[191𝐴017]
Code
n=-10:10;
x=exp((-.1+j.*0.3).*n);
subplot(2,2,1);
stem(n,abs(x));
title('magnitude plot');
xlabel('discrete n');
ylabel('amplitude in discrete');
subplot(2,2,2);
stem(n,angle(x));
title('phase plot');
xlabel('discrete n');
ylabel('phase in y');
x2=sigfold(x,n);
[191𝐴017]
x3=0.5*(x+x2);
subplot(2,2,3);
stem(n,x3);
title('even plot');
xlabel('discrete n');
ylabel('amplitude in discrete');
x3=0.5*(x-x2);
subplot(2,2,4);
stem(n,x3);
title('odd plot');
xlabel('discrete n');
ylabel('amplitude in discrete');
Function
function [y,n]=sigfold(x,m);
n=-fliplr(m);
y=fliplr(x);
Graph
Code
t=-13:13;
x1=2*stepseq(-10,-13,13)-2*stepseq(5,-13,13);;
subplot(2,2,1);
plot(t,x1);
grid on;
xlabel('time t');
ylabel('amplitude ');
title('plot of x1 function');
x2=0.66*(t.*stepseq(-3,-13,13)+t.*stepseq(3,-
13,13)+3*stepseq(-3,-13,13)-3*stepseq(3,-13,13))-
1.33*t.*stepseq(0,-13,13);
subplot(2,2,2);
plot(t,x2);grid on;
xlabel('time t');
ylabel('amplitude ');
title('plot of x2 function');
subplot(2,2,3);
x3=sigfold(x1,t);
plot(t,x3);grid on;
xlabel('time t');
ylabel('amplitude ');
title('plot of x3 function');
[191𝐴017]
Function
function [y,n]=sigfold(x,m);
n=-fliplr(m);
y=fliplr(x);
Graph
dfghjklzxcvbnmqwertyuiopasdfghjklzx
Jatin katiyar
191a017
cvbnmqwertyuiopasdfghjklzxcvbnmq
wertyuiopasdfghjklzxcvbnmqwertyuio
pasdfghjklzxcvbnmqwertyuiopasdfghj
klzxcvbnmqwertyuiopasdfghjklzxcvbn
mqwertyuiopasdfghjklzxcvbnmqwerty
uiopasdfghjklzxcvbnmqwertyuiopasdf
ghjklzxcvbnmqwertyuiopasdfghjklzxc
vbnmqwertyuiopasdfghjklzxcvbnmrty
uiopasdfghjklzxcvbnmqwertyuiopasdf
ghjklzxcvbnmqwertyuiopasdfghjklzxc
JATIN KATIYAR [191𝐴017]
Code
clc;
clear all;
n1=input('Enter range of first Sequence :');
n2=input('Enter range of second Sequence :');
x1=input('Enter first Sequence :');
subplot(3,1,1);
stem(n1,x1);
xlabel('n1');
ylabel('x(n)');
title('First sequence');
subplot(3,1,2);
stem(n2,x2); [191𝐴017]
xlabel('n2');
ylabel('h(n)');
title('Second sequence');
p=length(x1);
for i=1:p
hm=[zeros(1,i-1) x2 zeros(1,p-i)];
H(i,:) = hm;
end
y=x1*H;
y=
6 31 47 6 -51 -5 41 18 -22 -3 8 2
Graph
CODE
clc;
clear all;
n1=input('Enter range of first Sequence :');
n2=input('Enter range of second Sequence :');
x1=input('Enter first Sequence :');
x2=input('Enter second Sequence :');
n=(min(n1)+min(n2):max(n1)+max(n2));
subplot(3,1,1);
stem(n1,x1);
xlabel('n1');
ylabel('x(n)');
title('First sequence');
subplot(3,1,2);
stem(n2,x2);
xlabel('n2');
ylabel('h(n)');
title('Second sequence');
[191𝐴017]
p=length(x1);
for i=1:p
hm=[zeros(1,i-1) x2 zeros(1,p-i)];
H(i,:) = hm;
end
y=x1*H;
disp('Convolution Sum y(n) = ');y
subplot(3,1,3);
stem(n,y);
xlabel('n');
ylabel('y(n)');
title('Convolution Sum');
[191𝐴017]
ANSWER
y=
Columns 1 through 16
Columns 17 through 32
Columns 33 through 48
175 185 195 205 215 225 235 245 255 265 275 285 295 305 315 325
Columns 49 through 64
335 345 355 365 375 385 395 405 415 425 435 445 455 414 372 329
Columns 65 through 80
Columns 81 through 96
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
>>
GRAPH
[191𝐴017]
CODE
n=-25:25;
x1=cos((pi*n)/4).*(stepseq(-5,-25,25)-stepseq(25,-25,25));
x2= power(0.9,-n).*(stepseq(0,-25,25)-stepseq(20,-25,25));
n2=-10:10;
w=stepseq(-10,-10,10);
x3=round(5*w);
% subplot(2,2,1);
% stem(n,x1);
% xlabel('n1');
% ylabel('x1(n)');
% title('plot of input x1(n)');
%
% subplot(2,2,2);
% stem(n,x2); [191𝐴017]
% xlabel('n1');
% ylabel('x2(n)');
% title('plot of input x2(n)');
%
% subplot(2,2,3);
% stem(n2,x3);
% xlabel('n1');
% ylabel('x3(n)');
% title('plot of input x3(n)');
[y1,m1]=conv_sum(x2,n,x1,n);
[y2,m2]=conv_sum(x3,n2,y1,m1);
subplot(2,2,1);
stem(m1,y1);
xlabel('m1');
ylabel('y1(n)');
title('plot of input y1(n)');
subplot(2,2,2);
stem(m2,y2); [191𝐴017]
xlabel('m2');
ylabel('y2(n)');
title('plot of input y2(n)');
[y3,m3]=conv_sum(x3,n2,x1,n);
[y4,m4]=conv_sum(x2,n,y3,m3);
subplot(2,2,3);
stem(m4,y4);
xlabel('m4');
ylabel('y4(n)');
GRAPH
CODE
clc;
clear all;
a=[1];
b=[1 -1 0.9];
n=-10:120;
h=impz(a,b,n);
subplot(2,1,1);
stem(n,h);
xlabel('n');
ylabel('amplitude');
title('impluse response');
x=[zeros(1,10),ones(1,121)];
u=filter(a,b,x);
subplot(2,1,2)
stem(n,u);
xlabel('n');
ylabel('amplitude');
title('unitstep response');
CODE
clc;
clear all;
n=-3:4;
x=[3 8 7 2 0 -3 4 5];
w=rand(1,length(n));
[x2,n2]=sigshift(x,n,2); [191𝐴017]
[y,m]=sigadd(x2,n2,w,n);
[x1,n1]=sigfold(x,n);
[y1,m1]=conv_sum(x,n,x1,n1);
[y2,m2]=conv_sum(y,m,x1,n1);
subplot(2,2,1);
stem(n,x);
xlabel('n1');
ylabel('x(n)');
title('plot of input x(n)');
subplot(2,2,2);
stem(m,y);
xlabel('m');
ylabel('y(n)');
title('plot of input y(n)');
subplot(2,2,3);
stem(m1,y1);
xlabel('m1');
ylabel('rxx(n)');
title('autocorrelation');
subplot(2,2,4);
stem(m2,y2);
xlabel('n1');
ylabel('rxy(n)');
title('crosscorrelation');
GRAPH
JATIN KATIYAR
191A017
JATIN KATIYAR 191A017
Exercise#1
code
a_17=randn(4,4)
a_17(:,[3])=[6 9 2 5]
a_17(2,:)=[]
ans
a_17 =
a_17 =
a_17 =
Exercise#2
Code
a=[1,2,3,4;5,6,7,8;9,10,11,12;13,14,15,16]
b=[ a, a+32 ;a+48, a+16]
s=size(b)
ans
a=
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
b=
1 2 3 4 33 34 35 36
5 6 7 8 37 38 39 40
9 10 11 12 41 42 43 44
13 14 15 16 45 46 47 48
49 50 51 52 17 18 19 20
53 54 55 56 21 22 23 24
57 58 59 60 25 26 27 28
61 62 63 64 29 30 31 32
s=
8 8
[191𝐴017]
Exercise#3
code
n1=0:9;
x1=0.8+n1*0;
n2=10:19;
x2=0+n2*0;
n3=20:30;
x3=n3.^0.2+n3*0;
n=[n1 n2 n3];
x=[x1 x2 x3];
stem(n,x)
ans
Code
a_17=[2 -2;-1 2]
b_17=[1 -1;0 2]
c_17=[1;-2]
d_17=a_17+b_17
%e_17=a_17+c_17 invalid
f_17=b_17+d_17
g_17=b_17*c_17
h_17=a_17*b_17
i_17=a_17/d_17
%j_17=(c_17*c_17)*a_17 invlid
%k_17=(c_17.*c_17)*a_17 invalid
Ans
a_17 =
2 -2
-1 2 [191𝐴017]
b_17 =
1 -1
0 2
c_17 =
-2
d_17 =
3 -3
-1 4
f_17 =
4 -4
-1 6
g_17 =
-4
h_17 =
2 -6
-1 5
i_17 =
0.6667 0
-0.2222 0.3333
Code
a_17=1:2:5
x=size(a_17)
b_17=[a_17' a_17' a_17']
y=size(b_17)
c_17=b_17(1:2:3,1:2:3)
z=size(c_17)
d_17=a_17+b_17(2,:)
t=size(d_17)
e_17=[zeros(1,3) ones(3,1)' 3:5]
r=size(e_17)
ans
a_17 =
[191𝐴017]
1 3 5
x=
1 3
b_17 =
1 1 1
3 3 3
5 5 5
y=
3 3
c_17 =
1 1[191𝐴017]
5 5
z=
2 2
d_17 =
4 6 8
t=
1 3
e_17 =
0 0 0 1 1 1 3 4 5
r=
1 9
>>