Forums

Finding a Faster Way

Started by ygamez January 2, 2004
Here is the code snipet i need help with...

for i = 1:end_frame
for j = 1:1024
fout(i,j) = ifft(Z(i,j));
end
end

As you can see, if the end_frame is large, the for loop would take
so long. What alternatives can I do?

I've tried fout = ifft(Z); but it doesn't seem to give out the right
answer.

I've also tried
for i = 1:end_frame
fout(i,:) = ifft(Z(i,:));
end
but again it gives a different answer.

Which one gives the right answer anyway? And could you help me out
becuase this part takes very long in my program. By the way, the
dimension of Z is Z(1:end_frame,1:1024)



Hi,

ifft(z) where z is a matrix gives inverse DFT of each column of the
matrix.

> for i = 1:end_frame
> for j = 1:1024
> fout(i,j) = ifft(Z(i,j));
> end
> end

Here above, you are just taking one element of the matrix for
computation of idft. I guess this is not what you wanted.

and the other way you tried

> for i = 1:end_frame
> fout(i,:) = ifft(Z(i,:));
> end
Here you are computing idft for each row of the matrix, so you get a
different answer in all the three cases.

Just check your input matrix and apply the appropriate method.

regards,
Ravi
> Here is the code snipet i need help with...
>
> for i = 1:end_frame
> for j = 1:1024
> fout(i,j) = ifft(Z(i,j));
> end
> end
>
> As you can see, if the end_frame is large, the for loop would take
> so long. What alternatives can I do?
>
> I've tried fout = ifft(Z); but it doesn't seem to give out the right
> answer.
>
> I've also tried
> for i = 1:end_frame
> fout(i,:) = ifft(Z(i,:));
> end
> but again it gives a different answer.
>
> Which one gives the right answer anyway? And could you help me out
> becuase this part takes very long in my program. By the way, the
> dimension of Z is Z(1:end_frame,1:1024) >


V Ravi Chander
200211014
MTech (ICT)
DA-IICT

________________________________________________________________________
"If everything seems under control, you're just not going fast enough."
- Mario Andretti
________________________________________________________________________


It seems there are end_frame no of frames and in each frame is of 1024
values, right? So, unless U take N pt IFFT (where N >24), U cant get
correct answer. Try this -

N = 1024; % or any higher value
for m=1:end_frame
fout(m,:) = ifft(Z(m,:), N);
end

So far as execution speed is concern, remember we are not implementing
it on DSP kit. It's on simulation platform. so, it will be slower
always.

Regards
Santosh

^.*.^.*.^.*.^.*.^.*.^.*.^.*.^.*.^.*.^.*.^.*.^.*.^.*.^.*.^.*.^.*.^.*.^.*.
^.*.^.
,
/) Santosh V Jadhav,
// Narmada-127, Finolex Housing Colony,
(/ Zadgaon Block, Ratnagiri-415639
_/ _______
) ( (------( Phone: (02352) 221559(R)
/~~~\ \ SVJ \ (02352) 228361-505(O),
\___/ \ FAMT \ (022) 25764486 (TI-DSP Lab, IITB)
_)______)
`-------` EMails: IITB Home page -
http://www.ee.iitb.ac.in/uma/~santoshj

IITB Official Page -
http://www.ee.iitb.ac.in/Home/People/Students/PhD/info?02407802 _.*._.*._.*._.*._.*._.*._.*._.*._.*._.*._.*._.*._.*._.*._.*._.*._.*._.*.
_.*._. >
> Here is the code snipet i need help with...
>
> for i = 1:end_frame
> for j = 1:1024
> fout(i,j) = ifft(Z(i,j));
> end
> end
>
> As you can see, if the end_frame is large, the for loop would take
> so long. What alternatives can I do?
>
> I've tried fout = ifft(Z); but it doesn't seem to give out the right
> answer.
>
> I've also tried
> for i = 1:end_frame
> fout(i,:) = ifft(Z(i,:));
> end
> but again it gives a different answer.
>
> Which one gives the right answer anyway? And could you help me out
> becuase this part takes very long in my program. By the way, the
> dimension of Z is Z(1:end_frame,1:1024) >
> _____________________________________
> Note: If you do a simple "reply" with your email client, only
> the author of this message will receive your answer. You need to do a
> "reply all" if you want your answer to be distributed to the
> entire group.
>
> _____________________________________
> About this discussion group:
>
> To Join:
>
> To Post:
>
> To Leave:
>
> Archives: http://www.yahoogroups.com/group/matlab
>
> More DSP-Related Groups: http://www.dsprelated.com/groups.php3 > Yahoo! Groups Links
>
> To >
>


hi,
try both:

1. initialize the memory for fout before the for loop.
eg:
fout(1:1024,1:end_frame) = 0 or null ;

2. instead of calling ifft so many times, write ur self, a specialized ifft
for ur length. go to ifft.m and copy only some lines into ur program....

regards,
ravi

ygamez <> wrote:
Here is the code snipet i need help with...

for i = 1:end_frame
for j = 1:1024
fout(i,j) = ifft(Z(i,j));
end
end

As you can see, if the end_frame is large, the for loop would take
so long. What alternatives can I do?

I've tried fout = ifft(Z); but it doesn't seem to give out the right
answer.

I've also tried
for i = 1:end_frame
fout(i,:) = ifft(Z(i,:));
end
but again it gives a different answer.

Which one gives the right answer anyway? And could you help me out
becuase this part takes very long in my program. By the way, the
dimension of Z is Z(1:end_frame,1:1024)

_____________________________________
Note: If you do a simple "reply" with your email client, only the author of this
message will receive your answer. You need to do a "reply all" if you want your
answer to be distributed to the entire group.

_____________________________________
About this discussion group:

To Join:

To Post:

To Leave:

Archives: http://www.yahoogroups.com/group/matlab

More DSP-Related Groups: http://www.dsprelated.com/groups.php3 ---------------------------------
Yahoo! Groups Links

To Yahoo! India Mobile: Ringtones, Wallpapers, Picture Messages and more.Download
now.