Prev: zeros(100000, 3000); --> is possible
Next: How do I prevent a cell class variable from being converted to char class?
From: David Romero-Antequera on 4 Aug 2010 13:21 Hello, everyone. I need some suggestion to make the following function faster. function psi=NLF(z,y,funvector,orig_size) psi=zeros(size(y)); Y=ifft2(reshape(y,orig_size)); for fun=funvector fY=feval(fun{2},z,Y); kY=fun{1}.*fft2(fY); kY=kY(:); psi=psi+kY; end end where z is a double scalar, y is a complex matrix, funvector is a cell array with double scalars in the first column and function handles in the second, and orig_size is a 2x1 matrix. As you can see, I need to compute the inverse Fourier transform of the vector Y, then evaluate it into several user-provided functions and compute the Fourier transform and add all of that together. This is part of an ODE, so you might expect that this is going to be evaluated THOUSANDS of times, and every second counts. Any suggestions? Thanks in advance. |