MATLAB Answers

0

Does repeated use of ngrid suck up memory?

Asked by David Koenig on 22 Sep 2012
I calculate a 60,000 by 1000 grid using Matlab's ngrid function. While staying in the same script I often have to recalculate the grid for slightly different parameters. Each time I do it more time is required as measured by tic and toc.
The guts of the grid calculation are
% h=sampling interval, M= no. of samples
t=(1:M)*h; % time spacing
% fLfine=starting frequency, fRfine=stopping frequency % DelFreq=frequency interval
fs=fLfine:DelFreq:fRfine; % frequency spacing
[T F]=ndgrid(t,fs);
parameterList.A=exp(-1i*2*pi*F.*T);
T=[]; F=[];
Each time I pass through this calculation it takes longer. I notice it when I try the script on my Acer Aspire which has 4 gB memory. I don't notice it when I use my Toshiba Qosmio X775 which has 8 gB of memory and a faster processor.
Is there a reason why it takes progressively longer on the Acer and is there anything I can do about it?
Thanks,
Dave

  0 Comments

Sign in to comment.

0 Answers