From: aasim Azooz on 5 Mar 2010 04:26 "Ravi Rastogi" <raviras(a)gmail.com> wrote in message <hmoq29$d07$1(a)fred.mathworks.com>... > Hi Everyone, > > For my application i need to find out the Local Maxima and Minima of the any 1D data. > Here are the steps: > 1) Load the data; (Bx) > please email me and i will send you the data. > > 2) Determine the possible no of scales. > > %%Determining the maximum scale: > for p=1:20 > if((2^p)<=(length(Bx)/2)) > maxscl=2^p; > elseif((2^p)>=(Bx/2)) > break; > end > end; > > 3) Determine continuous wavelet transform coefficients for all the possible scales > > %%Continuous Wavelet Transform: > scale=1:maxscl; > space=1:length(Bx); > figure; > r=cwt(Bx,scale,'db10','plot'); > > 4) Use the Localmax function of wavelet toolbox to find and plot all the Local Maxima > plots. > > %%Determining Local Maximum of a MATRIX: > local_max_coef = localmax(r); > [Rows, Cols]= find(local_max_coef); > %Plot the maxima > figure; > plot(space(Cols),scale(Rows), ... > 'marker','*', ... > 'markersize',2, ... > 'linestyle','none', ... > 'color','k'); > > 5) Then i use a function called peakdet.m ( http://www.billauer.co.il/peakdet.html ) to determine the local max and minima points. > > %%Plotting scale space plot of maxima and minima > max_r(scale,space)=0; > min_r(scale,space)=0; > for scl=1:maxscl > [maxtab, mintab]=peakdet(r(scl,:), 1); % Determining maxima and minima > maxpos=round(maxtab(:,1)); %position of maxima in space > max_r(scl,maxpos)=1; > minpos=round(mintab(:,1)); > min_r(scl,minpos)=1; > end; > > %Plotting it: > figure; > imshow(~max_r); > title('Maxima Plot') > figure; > imshow(~min_r); > title('Minima Plot') > > PROBLEM: I want get a plot similar to step 4, but am not sure what is the best way to do it? so i tried out it in matrix and plotting the image, but since the matrix starts from (0,0) on the top left the whole plot looks inverted. Can someone suggest me a better way of plotting the data?? > > Thanks, > Ravi See my M-files Maxima and minima on the matlab file exchange library Aasim Azooz
First
|
Prev
|
Pages: 1 2 Prev: Crop pictures saved using print command Next: L moment for Gruped/Classed data |