clc
clear
v=[1 2 2 2 0 1 1 1];
l=length(v);
for k=1:l/2;
h(k)=v(2*k);
g(k)=v(2*(k-1)+1);
end
x=g+i*h;
X=fft(x);
Xc=conj(X);
Xci=[Xc(1) fliplr(Xc(2:4))];
G=(1/2)*(X+Xci);
H=(-i/2)*(X-Xci);
Wn=exp(-i*2*pi/l);
for p=1:l
if p>l/2
k=p-l/2;
else
k=p;
end
V(p)=G(k)+((Wn^(p-1))*H(k));
end
error=V-fft(v);
stem(error)
clear
v=[1 2 2 2 0 1 1 1];
l=length(v);
for k=1:l/2;
h(k)=v(2*k);
g(k)=v(2*(k-1)+1);
end
x=g+i*h;
X=fft(x);
Xc=conj(X);
Xci=[Xc(1) fliplr(Xc(2:4))];
G=(1/2)*(X+Xci);
H=(-i/2)*(X-Xci);
Wn=exp(-i*2*pi/l);
for p=1:l
if p>l/2
k=p-l/2;
else
k=p;
end
V(p)=G(k)+((Wn^(p-1))*H(k));
end
error=V-fft(v);
stem(error)
No comments:
Post a Comment