3 D plot of transfer function magnitude with complex axis

I am trying to plot the following transfer function's magnitude on a third(z) axis, however it contains a pole and the graph I am getting is obviously incorrect: s+1/s+2. Also i am getting the following warning, matrix is close to singular . My code is:
>> x=linspace(-10,10);
>> y=linspace(-10,10);
>> [X,Y]=meshgrid(x,y);
>> Z=abs((X+i*Y+1)/(X+i*Y+2));
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate.
RCOND = 2.503334e-20.
>> surf(X,Y,Z)
>> rotate 3d on;

 Respuesta aceptada

You forgot to do element-wise division (using (./) instead of (/)).
This works:
x=linspace(-10,10);
y=linspace(-10,10);
[X,Y]=meshgrid(x,y);
Z=abs((X+i*Y+1)./(X+i*Y+2));
figure(1)
surfc(X, Y, Z)
grid on
xlabel('Real')
ylabel('Imaginary')
view([30 30])
I rotated the plot (using the view function) so you can see the zero as well as the pole.

2 comentarios

Thanks! I was able to get the same result yesterday using sysms and fsurf. Now i can use your method for all other plots too.
My pleasure!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Mathematics en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 23 de Abr. de 2017

Comentada:

el 24 de Abr. de 2017

Community Treasure Hunt

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

Start Hunting!

Translated by