steepest_descent.m
上传用户:kendun0711
上传日期:2007-06-03
资源大小:32k
文件大小:1k
- function [v, w]= steepest_descent(rp)
- % function [v, w]= steepest_descent(rp)
- %
- % computes trajectories of the steepest descent algorithm
- % it requires the passing of a structure that contains all
- % of the run parameters (mkrp.m generates this structure)
- mu=rp.mu; Nn=rp.Nn;
- a1=rp.a1; a2=rp.a2; lam1=rp.lam1; lam2=rp.lam2;
- disp(['a1: ', num2str(a1), ' a2: ', num2str(a2), ' lam1: ', ...
- num2str(lam1), ' lam2: ', num2str(lam2)]);
-
- v(1:2, 1) = (-1/sqrt(2)) * [a1 + a2; a1 - a2]; % initial case
- v(1, 2:Nn) = ((1 - mu*lam1).^(2:Nn)) * v(1,1);
- v(2, 2:Nn) = ((1 - mu*lam2).^(2:Nn)) * v(2,1);
- w(1,:) = -a1 + (v(1,:) + v(2,:)) / sqrt(2);
- w(2,:) = -a2 + (v(1,:) - v(2,:)) / sqrt(2);