Question: clc; clearvars; close all; disp ( Name : HARI KRISHNA A ) ; disp ( Roll no: 2 2 L 1 1

clc;
clearvars;
close all;
disp("Name : HARI KRISHNA A");
disp("Roll no: 22L115");
%inputsignal
n=-8:6;
x=[202202202202202];
figure(1);
stem(n,x);
xlabel('n');
ylabel('x[n]');
title('Input signal');
axis([min(n)-1 max(n)+1 min(x)-1 max(x)+1]);
%one period
n1=0:2;
x1=[220];
ku=input("Enter the Value Of K :");
%analysis
o=(2*pi)/3;
a=[];
m=1;
for k=-ku:ku
s=0;
s1=1;
for nn=0:2
s=s+(x1(s1).*exp(-1i*k*o*nn));
s1=s1+1;
end
a(m)=(1/3)*s;
m=m+1;
end
k=-ku:ku;
figure(2);
subplot(2,1,1);
stem(k,abs(a));
xlabel('k');
ylabel('|ak|');
title('Magnitude of ak');
axis([min(k)-1 max(k)+1-1 max(abs(a))+1]);
subplot(2,1,2);
stem(k,angle(round(a,10)));
xlabel('k');
ylabel('Phase');
title('Phase of ak');
axis([min(k)-1 max(k)+1 min(angle(a))-1 max(angle(a))+1]);
%synthesis
x2=[];
l=1;
for n2=-8:6
s2=0;
m1=1+ku;
for k=0:2
s2=s2+(a(m1).*exp(1i*k*o*n2));
m1=m1+1;
end
x2(l)=s2;
l=l+1;
end
figure(3);
subplot(2,1,1);
n=-8:6;
stem(n,x);
xlabel('n');
ylabel('x[n]');
title('Input signal');
axis([min(n)-1 max(n)+1 min(x)-1 max(x)+1]);
subplot(2,1,2);
stem(n,round(x2,10));
xlabel('n');
ylabel('xn[n]');
title('Input signal using synthesis equation');
axis([min(n)-1 max(n)+1 min(x)-1 max(x)+1]);
convert this MATLAB CODE to python idle code

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!