Double for Loop to find root of polynomial

Alexander Kimbley

Alexander Kimbley (view profile)

님이 질문을 제출함. 30 Oct 2019
최근 활동 Alexander Kimbley

Alexander Kimbley (view profile)

님이 댓글을 추가함. 31 Oct 2019
John D'Errico

John D'Errico (view profile)

님이 답변을 채택함.
Hi,
I'm trying to code a double for loop for the variables M and L, allowing me to find the roots of the polynomial at each point for 0<M, L<1. I'm very new to MATLAB and can't really get anything useful.
Thanks.

로그인 to comment.

답변 수: 1

John D'Errico (view profile)

on 30 Oct 2019

lambda=2;
Quadratic_For_Omega_Squared=@(L,M)[1,-(L^2 +2 * M^2 +1 -lambda), +M^2 * (L^2 +M^2 -lambda)];
L=1:-0.1:0;
M=1:-0.1:0;
R = zeros(numel(L),numel(M),2);
for k1 = 1:numel(L);
for k2 = 1:numel(M);
R(k1,k2,:) = roots(p);
end
end

댓글 수: 1

Alexander Kimbley

Alexander Kimbley (view profile)

on 31 Oct 2019
Thanks,
is there anyway I could extend this question for the code to present a graph in (L,M) space where each point is a certain colour depending on how many roots at that point are postive, i.e. 0,1 or 2.
Thanks.

로그인 to comment.

Translated by