How to plot and find zeros of a complex polynomial?

2 ビュー (過去 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 Center および File ExchangeProgramming についてさらに検索

製品


リリース

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by