How to plot real and complex parts of a function in 3d?
조회 수: 15 (최근 30일)
이전 댓글 표시
i have an assignment that reads as such:


My task is to plot 3 sub plots showing G in terms of real, complex, and the magnitude of the transfer function. I assume by magnitude, they mean the original plot with real and complex combined, if not then I will have to rework my equation. I have found a way, I think to graph the 3d plot by using resources in previously asked questions. My code looks as such:
clear
[x,y] = meshgrid(-10: 0.5: 10);
s = x + 1i*y;
G = abs(((s+2) ./ ((s.^2) + 6.*s + 18)));
figure;
surf(x,y,G)
Which results in an image as such:

My question is how do I split this graph into 2 subplots where I am showing the real and the complex independently? I don't see that type of question either in the Help section or in previously posted questions...
댓글 수: 0
답변 (2개)
Shyamali Abeysooriya
2021년 11월 28일
clear
[x,y] = meshgrid(-10: 0.5: 10);
s = x + 1i*y;
G = abs(((s+2) ./ ((s.^2) + 6.*s + 18)));
figure;
surf(x,y,G)
댓글 수: 0
KSSV
2017년 8월 29일
You can seperate the real part and complex part using real and imag.
real_part = real(s) ;
imag_part = imag(s) ;
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!