help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help improving performance of my phase shifting fft/ifft script tia


From: Ozzy Lash
Subject: Re: Help improving performance of my phase shifting fft/ifft script tia sal22
Date: Mon, 28 Feb 2011 13:04:25 -0600

> %Delay each fft component
>
> for k=1:length(z)
>
> w = 2*pi/N*(k-1);
>
> spec(k)=z(k)*exp(-j*w*num_samp);
>
> spec=spec';
>
> end;

I think you should be able to vectorize this loop.  I think the
following is equivalent:


w = 2*pi/N*((0:1:length(z)-1).');
spec=(z .* exp(-j*w*num_samp))';

I wasn't 100 percent sure what you sere doing with the

spec=spec';

line. It takes the complex cojugate transpose of the vector spec at
each loop iteration.  since spec is single dimension, that means it
changes from a row to column vector and back each time, and each
element is conjugated each time.  I assumed that you actually intended
to  have the following line:

spec(k)=spec(k)';

(or equivalently spec(k)=conj(spec(k));

If you really wanted to conjugate even (or odd) elements for spec, and
not the others, then there is probably a way to vectorize that as
well.

Bill


reply via email to

[Prev in Thread] Current Thread [Next in Thread]