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

📄 ldemo.m

📁 Lamda算法:GPS快速整周模糊度算法的核心
💻 M
📖 第 1 页 / 共 2 页
字号:
   % -------------------------------------------   % ------------------------------   % --- Box for compution time ---   % ------------------------------      % ------------------------------------------   % --- Box for output of results integers ---   % ------------------------------------------   h = uicontrol (...       'Style','Text', ...       'Position',[5 124 300 16], ...       'String','Estimated fixed ambiguities:', ...       'HorizontalAlignment','Left', ...       'BackgroundColor', [0.8 0.8 0.8]);      h = uicontrol ( ...       'Style','Edit', ...       'Position',[2 2 636 120], ...       'BackgroundColor',[1 1 1], ...       'HorizontalAlignment','left', ...       'FontName','Courier New', ...       'Max',10, ...       'Tag','results');case 'intout';   switch option1;   case '0';      set (findobj (gcf,'Tag','IntOut0'),'Value',1);      set (findobj (gcf,'Tag','IntOut1'),'Value',0);      set (findobj (gcf,'Tag','IntOut2'),'Value',0);   case '1';      set (findobj (gcf,'Tag','IntOut0'),'Value',0);      set (findobj (gcf,'Tag','IntOut1'),'Value',1);      set (findobj (gcf,'Tag','IntOut2'),'Value',0);   case '2';      set (findobj (gcf,'Tag','IntOut0'),'Value',0);      set (findobj (gcf,'Tag','IntOut1'),'Value',0);      set (findobj (gcf,'Tag','IntOut2'),'Value',1);   end;   case 'SelectFile';   switch option1;         case 'In';            [FileName,PathName] = uigetfile ('*.mat','Select file');      load ([PathName FileName]);      Qahat  = Q; clear Q;      afloat = a; clear a;      curdim = size(Qahat,1);      %[FileName,PathName]   = uigetfile ('*.amb','Select file');      %      [Qahat,afloat,curdim,ierr] = ReadCovar ([PathName FileName]);            h = findobj (gcf,'Tag','InputFile');      set (h,'String',FileName);      h = findobj(gcf,'Tag','dimension');      set (h,'String',num2str(curdim));      for i = 1:maxdim;         tag = ['float' sprintf('%2.2d',i)];         h   = findobj(gcf,'Tag',tag);         if i <= curdim;            set (h,'Enable','On');            set (h,'String',sprintf ('%8.4f',afloat(i)));         else;            set (h,'Enable','Off');            set (h,'String','0.0000');         end;      end;      for i = 1:maxdim; for j = 1:maxdim         tag = ['mat' sprintf('%2.2d',i) sprintf('%2.2d',j)];         h   = findobj(gcf,'Tag',tag);         if i <= curdim & j <= curdim;            set (h,'Enable','On');            set (h,'String',sprintf ('%8.4f',Qahat(i,j)));         else;            set (h,'Enable','Off');            set (h,'String','0.0000');         end;      end; end;   case 'Out';            [FileName,PathName]   = uiputfile ('*.log','Select file');      h = findobj (gcf,'Tag','OutputFile');      set (h,'String',FileName);      set (findobj (gcf,'Tag','IntOut0'),'Value',0);      set (findobj (gcf,'Tag','IntOut1'),'Value',0);      set (findobj (gcf,'Tag','IntOut2'),'Value',1);   end;case 'dimension';   % -------------------------------------------   % --- Change the dimension of the problem ---   % -------------------------------------------      h = findobj(gcf,'Tag','dimension');   curdim = str2num (get (h,'String'));   if curdim < 1 | curdim > maxdim;      msgbox ('Please select a dimension between 1 and 12','Illegal dimension','error');   end;   for i = 1:maxdim;      tag = ['float' sprintf('%2.2d',i)];      h   = findobj(gcf,'Tag',tag);      if i <= curdim;         set (h,'Enable','On');      else;         set (h,'Enable','Off');      end;   end;   for i = 1:maxdim; for j = 1:maxdim      tag = ['mat' sprintf('%2.2d',i) sprintf('%2.2d',j)];      h   = findobj(gcf,'Tag',tag);      if i <= curdim & j <= curdim;         set (h,'Enable','On');      else;         set (h,'Enable','Off');      end;   end; end;case 'makesymm'   i   = str2num (option1(4:5));   j   = str2num (option1(6:7));   h   = findobj(gcf,'Tag',option1);   tmp = get (h,'String');   tag = ['mat' sprintf('%2.2d',j) sprintf('%2.2d',i)];   h   = findobj(gcf,'Tag',tag);   set (h,'String',tmp);   case 'compute'   % ------------------------------------   % --- Collect the input for LAMBDA ---   % ------------------------------------   watchon;   h      = findobj(gcf,'Tag','ncands');   ncands = str2num(get(h,'String'));   h = findobj(gcf,'Tag','dimension');   curdim = str2num (get (h,'String'));   afloat = zeros(curdim,1);   Qahat  = zeros(curdim,curdim);   for j = 1:curdim;      tag       = ['float' sprintf('%2.2d',j)];      h         = findobj (gcf,'Tag',tag);      afloat(j) = str2num(get(h,'String'));   end;      for i = 1:curdim; for j = 1:curdim;      tag        = ['mat' sprintf('%2.2d',i) sprintf('%2.2d',j)];      h          = findobj (gcf,'Tag',tag);      Qahat(i,j) = str2num(get(h,'String'));   end; end;   if get (findobj (gcf,'Tag','IntOut0'),'Value'); FidLog = 0; end;   if get (findobj (gcf,'Tag','IntOut1'),'Value'); FidLog = 1; end;   if get (findobj (gcf,'Tag','IntOut2'),'Value');      FileName = get (findobj (gcf,'Tag','OutputFile'),'String');      FidLog = fopen (FileName,'wt');   end;   % ------------------------------------------   % --- Perform checks on validity of data ---   % ------------------------------------------   % -------------------------------------   % --- Estimate integer using LAMBDA ---   % -------------------------------------      [afixed,sqnorm,Qahat,Z] = lambda1 (afloat,Qahat,ncands,FidLog);   if FidLog > 1; fclose (FidLog); end;      % ---------------------------------------------   % --- Write the results to the output-field ---   % ---------------------------------------------      string = char(ones(curdim+2,ncands*13+10)*32);   string(1,1:8) = 'fixed  :';   string(curdim+2,1:8) = 'sq.norm:';   for i = 1:curdim; for j = 1:ncands;      istart = 10 + (j-1)*13;      string(i,istart:istart+10) = sprintf ('%11.4f',afixed(i,j));   end; end;      for i = 1:ncands;      istart = 10 + (i-1)*13;      string(curdim+2,istart:istart+10) = sprintf ('%11.4f',sqnorm(i));   end;   h = findobj (gcf,'Tag','results');   set (h,'String',string);   watchoff;case 'about';	% -------------	% --- About ---	% -------------   helpwin (mfilename);case 'exit';	% ------------	% --- Exit ---	% ------------   close (gcbf);   disp ('Bye ...');otherwise;      disp (['Warning ldemo: Illegal option choosen, please try again ...']);   disp (['               Option: ' action]);end;% ----------------------------------------------------------------------% --- End of the main routine, start of internal functions ---% ----------------------------------------------------------------------function [Qahat,afloat,n,ierr] = ReadCovar (FileName)% ----------------------------------------------------------------------% Internal function: ReadCovar% Author...........:% Date.............:% Purpose..........:% Remarks..........:% ----------------------------------------------------------------------ierr      = 0;[Fid,Msg] = fopen (FileName,'r');if Fid == -1;    error (Msg);else;   [n,count]   = max(fscanf (Fid,'%d',1));   if count ~= 1; error ('Error ReadCovar: Error reading dimension (n) ==> Check inputfile ...'); end;      [Qahat,count] = fscanf (Fid,'%f',n*n);   if count ~= n*n; error ('Error ReadCovar: Error reading var/covar matrix (n) ==> Check inputfile ...'); end;      [afloat,count] = fscanf (Fid,'%f',n);   if count ~= n; error ('Error ReadCovar: Error reading float-vector (n) ==> Check inputfile ...'); end;   Qahat = reshape (Qahat,n,n);   fclose (Fid);   end;

⌨️ 快捷键说明

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