Problem in finding ABS of a complex number of 2D matrix

I've created a 2D matrix of size 4096x28 which contains complex numbers generated after performing FFT on a raw signal. Now I'm trying to find abs of the complex numbers in this matrix. But I get an error my code and error are as follows
%fft for X signal
fftx=fft(reshape(T_hor,4096,[]));
%Xn value of the complex signal
Xn = abs(fftx);
%phase angle for X signal
alpha = angle(fftx);
%FFT for Y signal
ffty= fft(reshape(T_ver,4096,[]));
%Yn value for the complex signal
Yn=abs(ffty,NFFT);
%phase angle for the second signal
beta=angle(ffty);
I get this error
"??? Error using ==> abs
Too many input arguments.
Error in ==> Test_run_discard_AU_2 at 31
Yn=abs(ffty,NFFT);"
Any hints or suggestions would be really helpful. Thanks in advance.

 Respuesta aceptada

Stephen23
Stephen23 el 17 de Feb. de 2015
Editada: Stephen23 el 17 de Feb. de 2015
abs only accepts one input argument, whereas you are trying to use it with two: abs(ffty,NFFT).
In fact abs is defined as a unary operation , so what operation are you hoping to achieve by providing it with two arguments?

4 comentarios

when I used the same abs function with a matrix say for example X is a matrix of 4096x1 and now the code is as follows
fftx = fft(x,NFFT);
ans = abs(fftx);
It worked and gave me result. Now I seem to have problem when I'm using 4096x28 matrix as input to fft. Is there anyway to solve it?
Stephen23
Stephen23 el 17 de Feb. de 2015
Editada: Stephen23 el 17 de Feb. de 2015
fft accepts a matrix input, as the documentation clearly states: If the input X is a matrix, Y = fft(X) returns the Fourier transform of each column of the matrix.
You don't say what the "problem" is and we can't read minds, so how do you expect me to tell you how "to solve it"? If you want to get advice you need to explain what you expect and what is happening.
Use
Yn=abs(ffty);
like Stephen Cobeldick said, and you should be fine.
Bharath
Bharath el 17 de Feb. de 2015
Sorry guys! Little confused. I used only one argument for abs for fftx but ffty I made a mistake. I didn't see that. So I was thinking something else. Thanks again for your valuable time.

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Preguntada:

el 17 de Feb. de 2015

Comentada:

el 17 de Feb. de 2015

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by