get_wav.m - Sheet1 Page 1 function...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Sheet1 Page 1 function [angles,sums,track_starts,fout] = get_wav %$Revision: 1.9 $ $Author: nailon $ $Date: 2004/05/09 20:17:32 $ %[angles,sums,track_starts] = get_wav - creates a wave matrix from % the track_piece image, and stores it in the global variable Gwave. % The current algorithm I use finds the peak intensity pixel, then % fits a parabola to that pixel and its two neighbors, then returns % the center of the parabola. global Gwave global track_piece global track_piece_debug global Gdebug global Grpm global Gsmooth_wave sums=0 track_starts=0 angles=0 fout=0 if (~exist('Gdebug', 'var') || length(Gdebug) == 0) Gdebug = 0 end [height width] = size(track_piece) if (height < 100 || width < 400) Gwave = zeros(1,width) return end f=0 for i=1:40:width-40 tmp_f=0 for i1=0:39 tmp_f= tmp_f + fft(track_piece(:,i+i1)) end f = f+ abs(tmp_f) end f(1:60)=0 f(floor(height/2):height) = 0 [m max_freq] = max(abs(f)) fout=f Gwave = zeros(max_freq, width) angles = zeros(1,width) for i=1:width f=fft(track_piece(:,i)) angles(i) = angle(f(max_freq)) end Sheet1 Page 2 track_width = height/max_freq angles = angles/(2*pi)*track_width %if (Grpm < 35) %angles = do_gaussian1d(angles, 10) %angles = mod(angles, track_width) % %end % % make the angles contiguous % for time=1:width-1 del = round((angles(time+1)-angles(time))/track_width) angles(time+1) = angles(time+1) - del*track_width end % % smooth the angles vector % %angles = do_gaussian1d(angles, 400) angles = do_gaussian1d(angles, 40) %for i=1:width-4 %angles(i) = (angles(i)+angles(i+1)+angles(i+2)+angles(i+3)+angles(i+4))/5.0%angles(i) = (angles(i)+angles(i+1)+angles(i+2)+angles(i+3)+angles(i+4))/5....
View Full Document

Page1 / 12

get_wav.m - Sheet1 Page 1 function...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online