How to plot a complex function in matlab like : f(z)=sin(z)?
22 views (last 30 days)
Show older comments
How to plot a complex function in matlab like : f(z)=sin(z)?
z is the complex like z=x+iy
0 Comments
Answers (1)
John D'Errico
on 21 Nov 2020
Edited: John D'Errico
on 21 Nov 2020
The problem is, if z is a complex variable, then so is the extension of sin(z) into the complex plane. For example...
sin(1 + i)
And that means you are asking to plot something that has FOUR dimensions. Remember that a complex variable is itself 2 variables stuffed into one. And since we cannot easily plot in 4 dimensions (unless your own personal holodeck is working, mine is always broken, and Starfleet Command never sends the parts I need. They just tell me to call the borg for parts. You know how well that would end.)
The point is, we can plot THREE dimensional things, but even that is as a projection into the 2-d plane of your monitor.
fr = @(xr,xi) real(sin(xr + i*xi));
fi = @(xr,xi) imag(sin(xr + i*xi));
fsurf(fr,'r')
hold on
fsurf(fi,'g')
I have plotted the real and imaginary parts separately, but on the same figure. Or I might have plotted them side-by-side, using subplot. But until the borg answers my calls, that blasted holodeck still won't work. Wait, wait, the doorbell is ringi..........
See Also
Categories
Find more on Legend 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!