% Experiments conducted 16 Feb 2006 by Sean Hardesty and Erin Noel % nylon string with no beads %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % edited from Sean Hardesty's fftwav.m filename = 'record000.wav'; % plots time and frequency data for wav file filename % Sean Hardesty (1 Feb 2006) [y,fs]=wavread(filename); N=2^floor(log(length(y))/log(2)); if (N < 0.75*length(y)) N=length(y); end %use the next line if you have an old version of Matlab w=fft(y(1:N,:).*kron(sin((0:(N-1))*pi/N)',ones(1,size(y,2)))); % me % w=fft(y(1:N,:).*kron(window(@hamming,N),ones(1,size(y,2)))); range=(1:(N/2-1))'; f=range*fs/N; figure(1), clf phi = (sqrt(5)+1)/2; axes('position', [.125 .15 .75 phi-1]) ax = [0 140 1e-0 1e4]; mygridsemycoarse(ax, [0:20:ax(2)], [1e1 1e2 1e3]) semilogy(f,abs(w(range,1)),'linewidth',1.5) xlabel('f (Hz)') title(sprintf('%s',filename)) axis(ax) set(gca,'xtick',[0:20:ax(2)]) print -depsc2 bead0 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% figure(2), clf phi = (sqrt(5)+1)/2; axes('position', [.125 .15 .75 phi-1]) ax = [0 640 1e-2 1e4]; mygridsemycoarse(ax, [0:100:ax(2)], [1e-1 1e0 1e1 1e2 1e3]) semilogy(f,abs(w(range,1)),'linewidth',1.5) xlabel('f (Hz)') title(sprintf('%s',filename)) axis(ax) set(gca,'xtick',[0:100:ax(2)]) print -depsc2 bead02 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% figure(3), clf phi = (sqrt(5)+1)/2; axes('position', [.125 .15 .75 phi-1]) ax = [0 4000 1e-3 1e4]; mygridsemycoarse(ax, [0:500:ax(2)], [1e-2 1e-1 1e0 1e1 1e2 1e3]) semilogy(f,abs(w(range,1)),'linewidth',1.5) xlabel('f (Hz)') title(sprintf('%s',filename)) axis(ax) set(gca,'xtick',[0:500:ax(2)]) print -depsc2 bead03