how to repeat cycles in a DFT equation
3 views (last 30 days)
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.
0 Comments
Answers (1)
Azzi Abdelmalek
on 28 Jul 2013
Edited: Azzi Abdelmalek
on 28 Jul 2013
Use repmat function
repmat(Xz,100,1)
See Also
Categories
Find more on Creating and Concatenating Matrices 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!