% Gregory J. Toussaint % ECE 417 Nonlinear and Adaptive Control % 26 Oct 98 % Homework Assignment 4 % Problem 16 % Filename: prob16_a_1.m % % Study of Recursive Least Squares Estimation % clear format compact % Open or create the file to write the LaTeX commands to fid = fopen('prob16.tex','a'); % Set up the string variables HW_Num = '4'; Prob_Num = '16'; Roman = 'i'; Letter = 'a'; % Adjust the plot number plot_number = 0; tex_print = 1; % Zero to not print .tex file, one to print % % Solve the homework problem. % % Use loops to examine all of the different cases. % % keep track of the plot numbers and *.ps files plot_number = plot_number + 1; title_str = (['HW ',HW_Num,' Prob ',Prob_Num,' (',Roman,'-',num2str(plot_number),'), G. J. Toussaint']); print_str = (['prob',Prob_Num,'_',Letter,'_',num2str(plot_number),'.ps']); % Sample the functions to be plotted to reduce the data t_new = t(1:10:length(t)); theta_new = theta_hat(:,1:10:size(theta_hat,2)); % Plot the sampled functions prob16_print(t_new,theta_new,theta_naught,title_str) % If desired, form the contents of the .tex file if tex_print tex_fig_print(fid,Prob_Num,Roman,Letter,num2str(plot_number),print_str, ... u_str,gamma,sigma^2,theta_hat_0); end; eval(['print -deps ',print_str]) status = fclose(fid); Results = [theta_hat(:,size(theta_hat,2)) theta_naught ... theta_hat(:,size(theta_hat,2))-theta_naught] % End of HW 4 Problem 16 % Gregory J. Toussaint