If you mean the eigenvalue largest in magnitude, this should give you a start.
Incorporating fmincon can automatize the search for an optimal x.
M=magic(5);
P=pascal(5);
A=@(x) x*M+(1-x)*P;
x=0:0.02:1;
for i=1:numel(x)
d(i) = abs( eigs(A(x(i)),1) );
end
[dmin,idd] = min(d);
x(idd) %show x for which eigenvalue largest in magnitude is minimum
3 Comments
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/513718-i-m-getting-an-error-related-to-fmincon#comment_817331
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/513718-i-m-getting-an-error-related-to-fmincon#comment_817331
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/513718-i-m-getting-an-error-related-to-fmincon#comment_817336
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/513718-i-m-getting-an-error-related-to-fmincon#comment_817336
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/513718-i-m-getting-an-error-related-to-fmincon#comment_817337
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/513718-i-m-getting-an-error-related-to-fmincon#comment_817337
Sign in to comment.