MATLAB CODE:-
clc
close all
clear all
X=input('Enter the sequence X:');
lx=length(X);
y=0;
for w=-2*pi:pi/500:2*pi;
y=0;
for i=1:lx
y=y+(X(1,i)*exp((-j)*(i-1)*w));
end
subplot(2,2,1);
plot(w,abs(y));
hold on
subplot(2,2,2);
plot(w,angle(y));
hold on
FIGURE:-
Sequence X:[1 1 1 1]
clc
close all
clear all
X=input('Enter the sequence X:');
lx=length(X);
y=0;
for w=-2*pi:pi/500:2*pi;
y=0;
for i=1:lx
y=y+(X(1,i)*exp((-j)*(i-1)*w));
end
subplot(2,2,1);
plot(w,abs(y));
hold on
subplot(2,2,2);
plot(w,angle(y));
hold on
FIGURE:-
Sequence X:[1 1 1 1]
0 comments
Post a Comment