How to plot and find zeros of a complex polynomial?

1 visualización (últimos 30 días)
simran
simran el 25 de Feb. de 2025
Respondida: Sam Chak el 25 de Feb. de 2025
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...

Respuestas (1)

Sam Chak
Sam Chak el 25 de Feb. de 2025
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

Categorías

Más información sobre Programming en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by