필터 지우기
필터 지우기

Need help with 3D surface plot of complex function

조회 수: 29 (최근 30일)
Joshua
Joshua 2014년 4월 10일
댓글: José Peralta 2020년 4월 30일
I'm pretty sure I understand how to code this, the way the instructions are worded for it are confusing me. Here's a screenshot of them: http://i.imgur.com/Y6Rw8y6.png
So I understand I would simply make two vectors for the ranges of sigma and omega.
sig = -8:0.1:0;
omeg = -10:0.1:10;
Then the meshgrid
[X,Y] = meshgrid(sig, omeg);
Not quite sure how to create a vector for parts of the complex variable, a grid for s, or how to determine the magnitude of the function since it asks you to plot the real and imaginary components. I understand the real is sigma and the imaginary is omega, but then why does it add I may need to use the real and imag commands? The only surface plots I've done have been simple where you're given a range of two variables, you simply create the meshgrid, then evaluate the function using the meshgrid and save that as z, then plot it with the surf command. Also how come wn = 5 but then I'm given a range separately as well?
EDIT: This is what I have right now:
sigma = -8:0.1:0;
omega = -10:0.1:10;
[x,y] = meshgrid(sigma, omega);
s = x + y;
z = (5^2)./(s.^2 + 2*0.4*5.*s + 5^2);
surf(x,y,z);

답변 (2개)

Max Peterson
Max Peterson 2015년 5월 17일
Try this one:
[x,y] = meshgrid(-3 : 0.05: 3);
s = x + i*y;
z=abs((5^2)./(s.^2 + 2*0.4*5.*s + 5^2));
figure;
surf(x, y, z)
  댓글 수: 1
José Peralta
José Peralta 2020년 4월 30일
Hola buenas tardes. Podrías recomendarme bibliografía o ejemplos de gráficas de funciones de Variable Compleja. Muchas gracias.

댓글을 달려면 로그인하십시오.


Marta Salas
Marta Salas 2014년 4월 10일
편집: Marta Salas 2014년 4월 10일
s is a complex number and so it's F(s) (z in your code). This is why the problem ask you to plot the magnitude of F(s) which is the absolute value of F(s)
s = x + i*y;
z = (5^2)./(s.^2 + 2*0.4*5.*s + 5^2);
magnitude = abs(z);
surf(x,y,magnitude);
  댓글 수: 1
Max Peterson
Max Peterson 2015년 5월 17일
It doesn't work. I get following error message:
"Error using surf (line 57)
Z must be a matrix, not a scalar or vector."

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by