Hi the following script (not live script) can be executed in the matlab
editor, just on a cell
%%
A = [4,-2,-1,-1; -2,6,-2,-3; -1,-2,5,-1;-1,-3,-1,6]
x = [0;0;1;0]
[lambda,v] = eigs_potencia(A)
%%
function [lambda, v] = eigs_potencia(A)
[n,m] = size(A);
tol = 10^-6;
itermax = 50;
iter = 1;
v = rand(n,1);
v = v/norm(v);
w = [zeros(n,1)];
while (norm(v-w)>tol & norm(v+w)>tol)
w = v;
z = A*v;
lambda = transpose(v)*z;
v = z/norm(z);
iter = iter+1;
if iter > itermax
warning('se ha alcanzado el numero maximo de iteraciones')
break
end
end
lambda, v, iter
endHowever the command matlab-shell-run-cell seems not to recognize the function which is defined in the very same file. I think that is now an important feature to support, because matlab supports is also in the live scripts. Not sure how difficult that would be to implement. Any comments? Regards Uwe Brauer
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Matlab-emacs-discuss mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matlab-emacs-discuss
