Thread Subject: how to solve out of memory

Subject: how to solve out of memory

From: Clement Lim

Date: 26 Oct, 2009 13:57:03

Message: 1 of 1

Hi All, I had the below code to analyze the sound audio. However, i kept receiving the below error.

??? Error using ==> fft
Out of memory.

Can anyone advise?
Tks


[x,fs]=wavread('AVB.wav');
y=x(:,1);
Y = fft(y);
subplot(312)
plot(abs(Y));
xlabel('Frequency(Hz)');
ylabel('Magnitude');
axis([0 length(Y)/2, 0 max(abs(Y))]);
[nSamples,nChannels]=size(y);
waveFileLength=nSamples/fs;
N = 2^(nextpow2(length(y(:,1))));
Py=fft(y(:,1),N);
NumUniquePts = ceil((N+1)/2);
 Py = Py(1:NumUniquePts);
 Py = abs(Py);
 Py = Py/length(y(:,1));
 Py = Py.^2;
 Py = Py*2;
 Py(1) = Py(1)/2;
 if ~rem(N,2)
       Py(end) = Py(end)/2;
end
f = (0:NumUniquePts-1)*fs/N;
subplot(313)
plot(f,Py);
title(sprintf('Power Spectrum of wav file. Length=%3.1f sec, Fs=%d Sample/sec',waveFileLength, fs));
xlabel('Frequency(Hz)');
ylabel('Power');

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com