Professional Documents
Culture Documents
OUTPUT
L=
sum =
sum =
sum =
sum =
10
X=
10
sum =
sum =
1.0000 - 2.0000i
sum =
-2.0000 - 2.0000i
sum =
-2.0000 + 2.0000i
X=
sum =
sum =
-1.0000 - 0.0000i
sum =
2.0000 + 0.0000i
sum =
-2.0000 - 0.0000i
X=
sum =
sum =
1.0000 + 2.0000i
sum =
-2.0000 + 2.0000i
sum =
-2.0000 - 2.0000i
X=
>>
PROG 7A
close all;
clear all;
for n=1:10
x(n)=cos(0.48*pi*(n-1))+cos(0.52*pi*(n-1))
end;
N=10;
for k=0:9
sum=0;
for n=1:10
sum=sum+[x(n)*exp((-j*2*pi*k*(n-1))/N)]
end;
X(k+1)=sum;
end;
subplot(1,2,1);
stem(abs(X));
subplot(1,2,2);
stem(angle(X));
PROG 7B
close all;
clear all;
for n=1:100
x(n)=cos(0.48*pi*(n-1))+cos(0.52*pi*(n-1))
end;
N=100;
for k=0:99
sum=0;
for n=1:100
sum=sum+[x(n)*exp((-j*2*pi*k*(n-1))/N)]
end;
X(k+1)=sum;
end;
subplot(1,2,1);
stem(abs(X));
subplot(1,2,2);
stem(angle(X));
PROG 1
x=0:0.1:2*pi;
y=sin(x);
z=cos(x);
subplot(2,2,1);
plot(x,y);
title('Sin Continous');
xlabel('x');
ylabel('function');
subplot(2,2,2);
stem(x,y);
title('Sin Discrete');
xlabel('x');
ylabel('function');
subplot(2,2,3);
plot(x,z);
title('Cos Continous');
xlabel('x');
ylabel('function');
subplot(2,2,4);
stem(x,z);
title('Cos Discrete');
xlabel('x');
ylabel('function');
x=0:0.1:5;
y=exp(x);
subplot(1,2,1);
plot(x,y);
xlabel('time');
ylabel('value');
title('Exponential y=exp(x) - Continuous');
y=exp(-x);
subplot(1,2,2);
stem(x,y);
xlabel('sample');
ylabel('value');
title('Exponential y=exp(-x) - Discrete');
DTFT(Q2)
close all
clear all
x=[1,2,3,4,5,6]
p=1
q=1
N=length(x)
for w=0:0.1:2*pi
sum=0;
for n=1:N
sum=sum+x(n)*exp(-j*w*(n-p));
end
X(q)=sum;
q=q+1;
end
c=abs(X);
d=angle(X);
w=0:0.1:2*pi;
subplot(2,2,3)
plot(w,c,'r')
subplot(2,2,4)
plot(w,d,'b')