:-)
On Mon, Feb 28, 2011 at 9:04 AM, Ozzy Lash
<address@hidden> wrote:
> %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
--
--
|======================================================|
|
http://www.onewithall.net/ |======================================================|
|"Knowledge may be the Key"
|"But wisdom unlocks the door"
|"Absolute Power demands absolutely nothing"
"The bourgeois today burns as heretics and hangs as criminals those to whom he erects monuments tomorrow" ('Steppenwolf')
|======================================================|