Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: plotting complex numbers
Date: Fri, 5 Dec 2008 16:00:21 +0000 (UTC)
Organization: Atlantic Inertial Systems
Lines: 32
Message-ID: <ghbj6l$9v8$1@fred.mathworks.com>
References: <ghbfm4$bfh$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1228492821 10216 172.30.248.35 (5 Dec 2008 16:00:21 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 5 Dec 2008 16:00:21 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1405925
Xref: news.mathworks.com comp.soft-sys.matlab:505205


"Jason" <j_henderson44@REMOVEhotmail.com> wrote in message <ghbfm4$bfh$1@fred.mathworks.com>...
> Hello,
> 
> I have MATLAB which I have used very successfully for other stuff. I have never used it for complex numbers. A colleague wishes to plot a function - he is having problems with another program and asked me about Matlab ;-)
> 
> The funtion is
> 
> 1 + 1/(x(iy-x)) 
> 
> for -2 < x < 2
>     -2  < y < 2
> 
> I am guessing I need to plot an array of complex numbers or something
> 
> Can some kind soul please tell me how to do this? I would rather not have to do a refresher course on complex numbers ;-)

you can just plot imaginary numbers

x = -2: 0.01: 2;
[X Y] = meshgrid(x);
Z = 1+1./(X .* (1i*Y-X));

plot(Z, '.-')

do you want to plot it vs x and y?  In signal processing you would do magnitude and phase plots
mesh(X, Y, log10(abs(Z)))

mesh(X, Y, unwrap(angle(Z)))

If this doesn't help you may need to explain more.
~Adam