www.pudn.com > Kalman_matlab00000.rar > input_callback.m, change:2003-10-29,size:2059b


function input_callback() 
 
%%%%%%%%%%%%%%%%%%%%% 
% defaut parameters % 
%%%%%%%%%%%%%%%%%%%%% 
A=[1 0  
   0 1];          %(k+1,k) 
B=[.1 .3 
   .2 .2];        %(k+1,k) 
H=[.1 2 
   .3 .4];        %H(k) 
Q=[.2 .1 
   .1 .4];        %Q(k) 
R=[.1 .05 
   .05 .1];       %R(k) 
P0=[.1 0 
     0 .4];       %P(0) 
X0=[0 0]';        %X(0,0) 
 
%%%%%%%%%%%%%% 
% inpudialog % 
%%%%%%%%%%%%%% 
prompt={'(k+1,k):(nn)','(k+1,k):(np)','H(k):(mn)','Q(k):(pp)','R(k):(mm)',... 
        'P(0):(nn)','X(0,0):(n1)'}; 
title='Input Parameters'; 
lines=[2 2 2 2 2 2 2]; 
def={num2str(A),num2str(B),num2str(H),num2str(Q),num2str(R),num2str(P0),... 
        num2str(X0)}; 
answer=inputdlg(prompt,title,lines,def); 
if isempty(answer) 
    return 
end 
 
%%%%%%%%%%%%%%%%%%% 
% save parameters % 
%%%%%%%%%%%%%%%%%%% 
 
exist=0; 
if ~isempty(answer{1}) 
   A=str2num(answer{1}); 
    if exist  
       save inidata A -append; 
    else 
       save inidata A; 
       exist=1; 
    end 
end 
if ~isempty(answer{2}) 
   B=str2num(answer{2}); 
    if exist  
       save inidata B -append; 
    else 
       save inidata B; 
       exist=1; 
    end 
end 
if ~isempty(answer{3}) 
   H=str2num(answer{3}); 
    if exist  
       save inidata H -append; 
    else 
       save inidata H; 
       exist=1; 
    end 
end 
if ~isempty(answer{4}) 
   Q=str2num(answer{4}); 
    if exist  
       save inidata Q -append; 
    else 
       save inidata Q; 
       exist=1; 
    end 
end 
if ~isempty(answer{5}) 
   R=str2num(answer{5}); 
    if exist  
       save inidata R -append; 
    else 
       save inidata R; 
       exist=1; 
    end 
end 
if ~isempty(answer{6}) 
   P0=str2num(answer{6}); 
    if exist  
       save inidata P0 -append; 
    else 
       save inidata P0; 
       exist=1; 
    end 
end 
if ~isempty(answer{7}) 
   X0=str2num(answer{7}); 
    if exist  
       save inidata X0 -append; 
    else 
       save inidata X0; 
       exist=1; 
    end 
end 
 
CI=findobj(gcf,'tag','compo1'); 
set(CI,'userdata',[]); 
 
generatezk;