How to plot and find zeros of a complex polynomial?

4 Ansichten (letzte 30 Tage)
simran
simran am 25 Feb. 2025
Beantwortet: Sam Chak am 25 Feb. 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...

Antworten (1)

Sam Chak
Sam Chak am 25 Feb. 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

Kategorien

Mehr zu Programming finden Sie in Help Center und File Exchange

Produkte


Version

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by