# Fast Fourier Transform MATLAB [duplicate]

This question already has an answer here:

I dont understand one thing when I use the function fft(x,N) in matlab, where x is the signal which I want to calculate the fourier transform and N is the number of samples. What I dont understant when I represent the fft in a graph is the amplitude. Suppose that x is a cosine wave and N=1024, why the amplitude of the two deltas are different from PI? In concrete, why N affect the amplitude in fft? What have to do with that? I hope you can understand me. Thanks in advance

## marked as duplicate by Peter K.♦Mar 19 '18 at 12:19

• Have you read the Matlab docs (doc fft)? They give exactly the formula used for the DFT; from that you can directly infer the amplitude! – Marcus Müller Mar 19 '18 at 9:26
• I was refering to the formulas in de.mathworks.com/help/matlab/ref/fft.html#buuutyt-5 ; your problem has nothing to do with zeropadding. Simply insert your cosine into that $Y(k)$ and test what the result is – it's never $\pi$ (I must admit I'm not even sure where your idea comes from it should be $\pi$ – you might be confusing this with the continuous Fourier transform, maybe?) – Marcus Müller Mar 19 '18 at 9:46
• so,in $Y(k)$ the amplitude is multiplied by $W$ ? – victor26567 Mar 19 '18 at 9:50