From: Anthony Hopf on 26 Apr 2010 16:43 "xiong " <xionglei092292(a)sina.com> wrote in message <hjcals$ibb$1(a)fred.mathworks.com>... > "Bjorn Gustavsson" <bjonr(a)irf.se> wrote in message <hjc7sd$jhh$1(a)fred.mathworks.com>... > > "xiong " <xionglei092292(a)sina.com> wrote in message <hjc3sd$5l6$1(a)fred.mathworks.com>... > > > Hello for everyone, > > > I have a 200-by-500 matrix,each row corresponds to an individual beam (taken at a particular sonar transducer angle)(1.8 degree) and each column corresponds to the bin obtained at a particular distance from the transducer(0.1m).The values in the matrix represent echo-amplitude-returns in acoustic images. > > > I want to represent the matrix in polar coordinates and represent it in in Cartesian coordinates.I have used imagesc to represent the matrix in polar coordinates,but I do not known how to tell Matlab to represent the matrix in Cartesian coordinates. > > > Would anyone can help me? > > > Thanks. > > Maybe what you're after is something like this: > > phi = ([1:200]*dphi+phi0)*pi/180; > > r = [1:500]*1.8; > > [PHI,R] = meshgrid(phi,r); > > % To display the data: > > pcolor(R.*cos(PHI),R.*sin(PHI),data),shading flat > > % To resample to cartesian coordinates: > > n_bins = 2000; > > % set it to something suitable, medium big here since data points close to > > % (0,0) > > x = linspace(-max(r),max(r),n_bins); > > y = linspace(-max(r),max(r),n_bins); > > Data = griddata(R(:).*cos(PHI(:)),R(:).*cos(PHI(:)),data(:)); > > > > HTH, > > Bjeorn > I used imagesc to represent it in polor coordinates.Somebody told me to use poi2cart to represent it in Cartesian coordinates.But until now I can not make it . > Could anyone help me? Xiong, It looks like Bjeorn basically did this... except he calculated the pol2cart transform in the last line starting with Data. Did you find another way to do this? T
|
Pages: 1 Prev: image mosaic Next: Hankel functions and symbolic toolbox environment |