% Airekc1.m Main script for AireAiPrime
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The script for demonstration of an application of the function cxroot for
% finding one complex root of the complex function. These problems appear
% in the MATLAB Newsgroup rather often, say at
% http://www.mathworks.com/matlabcentral/newsreader/view_thread/242081#620527
% and more times before.
% This script shows how to shows how to transfer parameters k an c1 into
% the solution by the use of nested function without global variables.
%
% The function cxroot is called fron the user-written function, which has
% for this particular problem the name AireAiPrime.
% miroslav AT balda DOT cz
% 2009-01-08
% Test, whether the needed functions are present
Id = '';
if ~exist('inp.m','file'), Id=[Id ' inp (FEX Id= 9033)\n']; end
if ~exist('LMFnlsq.m','file'), Id=[Id ' LMFnlsq (FEX Id=17534)\n']; end
if ~exist('cxroot.m','file'), Id=[Id ' cxroot (FEX Id= )\n']; end
if ~isempty(Id)
error(['\nDownload missing function(s):\n' Id ...
'from File Exchange\n']);
end
k = inp('k ',1); % argument of aire function
c1 = inp('c1 ',1); % parameter of the argument w
Rew = inp('Re w0',5); % real part of w0
Imw = inp('Im w0',5); % imag part of w0
w0 = complex(Rew,Imw); % initial guess of a root
Options = {'Display',-2}; % display every second iteration
% without scales lambda (from LMFnlsq)
[w,ssq,cnt] = AireAiPrime(k,c1,w0,Options) % User written function
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~