How to plot real and complex parts of a function in 3d?
Show older comments
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...
Answers (2)
Shyamali Abeysooriya
on 28 Nov 2021
1 vote
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)
KSSV
on 29 Aug 2017
You can seperate the real part and complex part using real and imag.
real_part = real(s) ;
imag_part = imag(s) ;
Categories
Find more on Polar Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!