i dont know why my code is not working..
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
if true
fs = 200;
Ts = 1/fs;
t = 0:Ts:50; % Zaman vektörü
u2=sin(2.*pi.*(1+5.*t).*t);
N=ceil(log2(length(u2)));
for k=1:N
X(k)=0;
for n=1:N
X(k)=X(k)+u2(n).*exp(-1j.*2.*pi.*(n-1).*(k-1)./N);
end
end
Pyy=X.*conj(X);
f=fs*(0:(2^(N-1)-1))/2^N;
figure(1),plot(f,Pyy(1:2^(N-1)));
[MAX, MAXidx] = max(Pyy(1:2^(N-1)));
hold on
plot(f(MAXidx), MAX,'or')
end
Index exceeds matrix dimensions.
0 Kommentare
Antworten (1)
Yona
am 24 Dez. 2014
plot(f,Pyy(1:2^(N-1)));
the length of pyy in 14 so you cannot take cell number 16384 (2^13).
another problem: length(f)=8196 so length(Pyy) need to be the same.
3 Kommentare
Siehe auch
Kategorien
Mehr zu Discrete Fourier and Cosine Transforms finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!