How to plot and find zeros of a complex polynomial?

조회 수: 1 (최근 30일)
simran
simran 2025년 2월 25일
답변: Sam Chak 2025년 2월 25일
Given any complex polynomial, how to find and plot zeros in a complex plane? Here are a few examples what kind of plot i want...

답변 (1개)

Sam Chak
Sam Chak 2025년 2월 25일
I am unsure whether a symbolic approach exists. However, to use the fsolve() function, you need to provide initial guesses, which I have roughly estimated based on your image.
% Complex polynomial
function F = complexPolynomial(z)
F(1) = z(1)^5 + 1.2*conj(z(1))^4 - 1; % Real part
F(2) = imag(z(1)); % Imaginary part
end
% Initial guesses for z
initial_guesses = [1.0 + 0.0i;
-1.0 - 1.0i;
-1.0 + 1.0i;
0.6 - 1.2i;
0.6 + 1.2i;
1.0 - 0.3i;
1.0 + 0.3i];
% For storing solutions
solutions = [];
% Solve using fsolve for each initial guess
options = optimoptions('fsolve', 'Algorithm', 'levenberg-marquardt', 'Display', 'off');
for i = 1:length(initial_guesses)
z0 = initial_guesses(i);
solution = fsolve(@complexPolynomial, z0, options);
% Check if the solution is unique
if all(abs(solutions - solution(1)) >= 1e-6) % Tolerance for uniqueness
solutions = [solutions; solution(1)];
end
end
disp('Solutions:');
Solutions:
disp(solutions);
0.8370 + 0.0000i -1.0995 - 0.9097i -1.0995 + 0.9097i 0.6501 - 1.1865i 0.6501 + 1.1865i 1.0506 - 0.3025i 1.0506 + 0.3025i
% Plot
G = zpk([], solutions, 1);
pzmap(G), grid on

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

제품


릴리스

R2024b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by