diff util/classes/dictionaryMatrices/rotatematrix.m @ 184:8fc38e8df8c6 danieleb

Minor edits
author Daniele Barchiesi <daniele.barchiesi@eecs.qmul.ac.uk>
date Fri, 27 Jan 2012 13:18:50 +0000
parents 9c41f87dead7
children
line wrap: on
line diff
--- a/util/classes/dictionaryMatrices/rotatematrix.m	Fri Jan 27 13:15:11 2012 +0000
+++ b/util/classes/dictionaryMatrices/rotatematrix.m	Fri Jan 27 13:18:50 2012 +0000
@@ -1,5 +1,5 @@
 function [Dhat cost W] = rotatematrix(D,Phi,method,param)
-%
+% 
 %
 %
 % REFERENCE
@@ -90,24 +90,25 @@
 param.nIter = 300;				%number of iterations
 param.step  = 0.001;			%step size
 param.mu    = 0.01;			%regularization factor (for tangent method)
-methods = {'unconstrained','tangent','linesearchlie','conjgradlie'};
+methods = {'tangent','linesearchlie','conjgradlie'};
 
 Phi = randn(n,m);				%initial dictionary
 Qtrue = expm(skew(randn(n)));	%rotation matrix
 D = Qtrue*Phi;					%target dictionary
 
 cost = zeros(param.nIter,length(methods));
+times = zeros(param.nIter,length(methods));
 for iIter=1:length(methods)
 	tic
 	[~, cost(:,iIter)] = rotatematrix(D,Phi,methods{iIter},param);
-	time = toc;
-	sprintf('Method %s completed in %f seconds \n',methods{iIter},time)
+	times(:,iIter) = linspace(0,toc,param.nIter);
+	sprintf('Method %s completed in %f seconds \n',methods{iIter},toc)
 end
 
-figure, plot(cost)
-set(gca,'XScale','log','Yscale','log')
+figure, plot(times,cost)
+set(gca,'XScale','lin','Yscale','log')
 legend(methods)
 grid on
-xlabel('number of iterations')
+xlabel('time (sec)')
 ylabel('J(W)')
 end