How can I plug complex numbers in function ?

I have complex circle. Its center is at (2,0) and radius=0.5. I am trying to plug all my domain in a function and trying to plot answer. I have written the code like this but it doesn't work.
theta=0:0.0001:2*pi;
r=0.5;
x=r*cos(theta)-2;
y=r*sin(theta);
s=complex(x,y);
g=(s-1)/((s.^3)+4*(s.^2)+7*s+6)

 Réponse acceptée

Torsten
Torsten le 31 Oct 2018
theta=0:0.0001:2*pi;
r=0.5;
x=2+r*cos(theta);
y=r*sin(theta);
s=complex(x,y);
g=(s-1)./((s.^3)+4*(s.^2)+7*s+6);
plot(real(g),imag(g))

3 commentaires

@Torsten
x=r*cos(theta)-2;
I tried using the above why did it not produce the plot , just curious..
Torsten
Torsten le 31 Oct 2018
Modifié(e) : Torsten le 31 Oct 2018
x = 2 + r * cos(theta): for x = -2 + r * cos(theta), the center of the circle were at (-2,0) instead of (2,0).
The code from above does not work because
g=(s-1)/((s.^3)+4*(s.^2)+7*s+6)
instead of
g=(s-1) *.*/((s.^3)+4*(s.^2)+7*s+6)
madhan ravi
madhan ravi le 31 Oct 2018
Ah I See now thank you @Torsten

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Mathematics dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by