0% found this document useful (0 votes)
11 views2 pages

Quiz 9

Uploaded by

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

Quiz 9

Uploaded by

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

Kevin Murcia

N=30; % K-5 hasta k=5


T=3
w0=(2*pi)/T;
t=-4:0.01:4;
Nt=length(t);
x=zeros(1,Nt); %inicialmente x es o pato todo t

for k=-N:N %para k positivos y negativos


if k==0
c0=1/3;
x=x+c0;
else
ck=3/(4*k^2*(pi)^2) - (1i)/(2*k*(pi)) + (3 - 3*exp(((2*(pi)*k*(1i))/3)) +
2*(pi)*k*(1i))/(4*k^2*(pi)^2) - (3*exp((-(2*(pi)*k*(1i))/3)))/(4*k^2*(pi)^2);
x = x + ck*exp(j*k*w0*t);
end
end
figure(1)
plot(t,real(x))

magnitud=zeros(1,2*N+1);
fase=-zeros(1,2*N+1);
k2=1;
for k=-N:N
if k==0;
c0=1/3;
else
ck=3/(4*k^2*(pi)^2) - (1i)/(2*k*(pi)) + (3 - 3*exp(((2*(pi)*k*(1i))/3)) +
2*(pi)*k*(1i))/(4*k^2*(pi)^2) - (3*exp((-(2*(pi)*k*(1i))/3)))/(4*k^2*(pi)^2);
end
magnitud(k2) = abs(ck);
fase(k2)= angle(ck)*(180/pi);
k2=k2+1;
end
w=w0*(-N:N);
figure(2)
subplot(2,1,1)
stem(w,magnitud)
subplot(2,1,2)
stem(w,fase)

c0=1/3;
a0=c0;
ak= zeros(1,N);
bk=zeros(1,N);
Ak=zeros(1,N);
thetak=zeros(1,N);

for k=1:N
ck=3/(4*k^2*(pi)^2) - (1i)/(2*k*(pi)) + (3 - 3*exp(((2*(pi)*k*(1i))/3)) +
2*(pi)*k*(1i))/(4*k^2*(pi)^2) - (3*exp((-(2*(pi)*k*(1i))/3)))/(4*k^2*(pi)^2);
ak(k)=2*real(ck);
bk(k)=-2*imag(ck);
temp= ak(k) - j*bk(k);
Ak(k)=abs(temp);
thetak(k)=angle(temp)*(180/pi);

end
w=w0*(0:N);
figure(3)
subplot(2,1,1)
stem(w , [a0 Ak])
subplot(2,1,2)
stem( w , [0 thetak])

x2=zeros(1,Nt);
x2=x2+a0;
for k=1: N
x2=x2 + Ak(k)*cos(k*w0*t + thetak(k)*(pi/180));

end
figure(4)
plot(t,x2)

You might also like