how to repeat cycles in a DFT equation
Show older comments
Hello, I have to write a code for a DFT equation. I have the code for 1 cycle below and it comes out fine. Now I have to repeat the cycle 100 times with the same x(n). I am trying to repeat with a for loop but can't get the summation right.
n=0:1:1/f; %sequence of time samples
X=cos(2*pi*f*n); %first part of equation
Xz= [(X) zeros(1,10)]; %padding zeros
Xs=0;
so I end up saying I want to repeat Xz 100 cycles
for t=0:100 Xs(t+1)=Xs(t+1)+Xz end
but matlab says the sides are not equal? Any help would be great.
Answers (1)
Azzi Abdelmalek
on 28 Jul 2013
Edited: Azzi Abdelmalek
on 28 Jul 2013
Use repmat function
repmat(Xz,100,1)
1 Comment
steven
on 28 Jul 2013
Categories
Find more on Discrete Fourier and Cosine Transforms in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!