## plot a matrix with 50*50 elements

### plot a matrix with 50*50 elements

I have a matrix of 50*50 element called A whose elements are
imaginary numbers. I want to draw a plot in which these 2500 points
are connected in a planar way in the following way:
A(i,j) is connected to A(i-1,j) and A(i+1,j) and A(i,j+1) and
A(i,j-1)

For exaple suppose A=[1+i 1+2i 1+3i ; 2+i 2+2i 2+3i ; 3+i 3+2i 3+3i].
In this case a 4 squres are supposed to be ploted.

How should I do this?

With respect,
Zeinab Ghofrani

### plot a matrix with 50*50 elements

may be you are looking for:

A=[1+1i 1+2i 1+3i ; 2+1i 2+2i 2+3i ; 3+1i 3+2i 3+3i];
mesh(real(A),imag(A),zeros(size(A)));
view(0,90);

> I have a matrix of 50*50 element called A whose elements are
> imaginary numbers. I want to draw a plot in which these 2500 points
> are connected in a planar way in the following way:
> A(i,j) is connected to A(i-1,j) and A(i+1,j) and A(i,j+1) and
> A(i,j-1)

> For exaple suppose A=[1+i 1+2i 1+3i ; 2+i 2+2i 2+3i ; 3+i 3+2i 3+3i].
> In this case a 4 squres are supposed to be ploted.

Sorry, I don't know if this type of debugging problem is appropriate
for this forum, but if so, here goes:

I've always thought 1+1=2, until today that is when Matlab is trying
to tell me it is 50. This is Matlab ver 6.0 which I have been using
for about 2.5 years without ever seeing a problem like this.

My function is called fsav. A 3 line code snippet from it is:

f1
xyz = f1+1
fff = floc(xyz)

When I start the program, this is what I see in the command window:

>> fsav
End of file reached
f1 =
1
xyz =
50
???  Index exceeds matrix dimensions.
Error in ==> e:\mcode\misc\fsav.m
On line 144  ==>               fff = floc(xyz)
??? Error while evaluating text ButtonDownFcn.
>>

Isn't this saying that 1+1 = 50 ?

Pretty radical huh. I suppose the 3 line code snippet won't be
enough, but my function is 358 lines - too long to post here I
would think. If someone is curious enough to look at my function
you can find it on my web site at:

http://www.sigknowledge.com/matlab/fsav.m

If you actually want to run it, you need a data file that it reads
in which you can get at:

http://www.sigknowledge.com/matlab/FSAV161.DAT

Type "fsav"
You will see a figure with two text items.
Click on the first one, and you will see the above error message.
(Oh, I suppose you will have to edit line 12 "cd e:\flightsaver\data;"
to contain the directory name where you actually put the data file.)

Thanks in advance for any ideas you may have.

~Paul Mennen