www.gusucode.com > GPS仿真Matlab编程源码程序 > GPS仿真Matlab编程源码程序/test_gpsArray_single.m

    % ***** 由单颗卫星数据(>=4颗)合成阵列天线数据,
% ***** 
% ***  wl 2009.07.14
clc;
clear; close all

% 读取数据

N=6e4;   % 10ms数据,6M采样率


tic
for i=1:30   % 1 s data length,
    
   fid=fopen('C:\Documents and Settings\hpp\桌面\界面1019\sv2.dat');
   status=fseek(fid,2*N*(i-1),0)  % cof or "0"
   dat2=fread(fid,N,'uint16=>single'); % inf: end of the file ; 卫星2
   fclose(fid)
   guiyiDat2=(dat2-mean(dat2))/sqrt(var(dat2));
   
   fid=fopen('C:\Documents and Settings\hpp\桌面\界面1019\sv6.dat');
   status=fseek(fid,2*N*(i-1),0)  % cof or "0"
   dat3=fread(fid,N,'uint16=>single'); % inf: end of the file ; 卫星3
   fclose(fid)
   guiyiDat3=(dat3-mean(dat3))/sqrt(var(dat3));
   
   
    fid=fopen('C:\Documents and Settings\hpp\桌面\界面1019\sv20.dat');
   status=fseek(fid,2*N*(i-1),0)  % cof or "0"
   dat5=fread(fid,N,'uint16=>single'); % inf: end of the file ; 卫星5
   fclose(fid)
   guiyiDat5=(dat5-mean(dat5))/sqrt(var(dat5));
   
      
   fid=fopen('C:\Documents and Settings\hpp\桌面\界面1019\sv25.dat');
   status=fseek(fid,2*N*(i-1),0)  % cof or "0"
   dat7=fread(fid,N,'uint16=>single'); % inf: end of the file ; 卫星7
   fclose(fid)
   guiyiDat7=(dat7-mean(dat7))/sqrt(var(dat7));
   clear dat7
   
   fid=fopen('C:\Documents and Settings\hpp\桌面\界面1019\sv1.dat');
   status=fseek(fid,2*N*(i-1),0)  % cof or "0"
   dat8=fread(fid,N,'uint16=>single'); % inf: end of the file ; 卫星7
   fclose(fid)
   guiyiDat8=(dat8-mean(dat8))/sqrt(var(dat8));
   
   fid=fopen('C:\Documents and Settings\hpp\桌面\界面1019\sv22.dat');
   status=fseek(fid,2*N*(i-1),0)  % cof or "0"
   dat9=fread(fid,N,'uint16=>single'); % inf: end of the file ; 卫星7
   fclose(fid)
   guiyiDat9=(dat9-mean(dat9))/sqrt(var(dat9)); 
   
   fs=6e6;
   fc=4.309e6;
   T=1/fs;
   N=fs*0.01;
   t=(0:N-1)*T;
   s=zeros(1,N);

snr=-20;    % dB
As=10^(snr/20); % 以噪声为参考,设为1

randn('state',111);
s=As*guiyiDat2'+As*guiyiDat3'+As*guiyiDat5'+As*guiyiDat7'+As*guiyiDat8'+As*guiyiDat9'+randn(1,N);


s=round(s*2^3);
     
   fid=fopen('E:\single7.dat','a');   % 列优先存!!!
   count=fwrite(fid,s,'int8');       % 实部
   fclose(fid)
   
end

toc