⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 readmatrix.m

📁 SAR成像cs算法的点目标成像matlab仿真程序
💻 M
字号:
function partmatrix=readMatrix(filename,firstPix,numPix,firstEcho,numEchos)
% ========================================================================
% Chirp Scaling Algorithm - read raw data matrix
% Maurice Rueegg
% April 2005
% ========================================================================
% Program to extract a part of a SUN raster file
% ========================================================================
% Copyright (c) Maurice Rueegg (2005)
% Permission to use these scripts for SAR processing and related research
% is granted. Please acknowledge the Remote Sensing Laboratories of the
% University of Zurich, Switzerland.
% The author disclaims any responsibility for or liability related to this
% Software. Any questions, complaints or claims related to the Software
% may be directed to mrueegg@geo.unizh.ch. 
% ========================================================================

partmatrix=complex(zeros(numEchos,numPix));

% open the raster file and determine the file size from the header
fid=fopen(filename,'rb','ieee-be');
headerInts=fread(fid,8,'uint32');
ras_magic=headerInts(1);
ras_width=headerInts(2);
ras_height=headerInts(3);
ras_depth=headerInts(4);
ras_length=headerInts(5);
ras_type=headerInts(6);
ras_maptype=headerInts(7);
ras_maplength=headerInts(8);

bytesPerPixel=8;
valtype='float32';
disp('8 bytes per Pixel')

for k=1:firstEcho-1
    [curEcho,read_count]=fread(fid,ras_width*2,[valtype,'=>double']);
end    

numzeros=0;
nonzeros=0;

for k=1:numEchos
    [curEcho,read_count]=fread(fid,[1,ras_width*2],valtype);
    if read_count<ras_width*2
        error(['read only ',num2str(read_count),' numbers instead of ',...
                num2str(ras_width*2)])
    end
    im_range=2*firstPix:2:2*(firstPix-1+numPix);
    re_range=im_range-1;
    partmatrix(k,:)=(curEcho(re_range)+curEcho(im_range).*j);
        nonzeros=nonzeros+sum(abs(curEcho)>0);
        numzeros=numzeros+sum(abs(curEcho)==0);
end
fclose(fid);
return

% = end ==================================================================

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -