help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

newbie - matrix fill from vectors


From: Adam Majewski
Subject: newbie - matrix fill from vectors
Date: Thu, 03 Nov 2011 21:28:04 +0100
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.23) Gecko/20110921 Thunderbird/3.1.15

Hi,

I want to have am matrix of complex numbers representing quadrant plane


# integer coordinate = pixels
iSide =5; # side of matrix


# world ( float) coordinate - dynamical (Z) plane
dSide= -2.0
Zxmin = -dSide;
Zxmax = dSide;
Zymin = -dSide;
Zymax = dSide;

# vectors of coordinate
vZx = linspace(Zxmin,Zxmax,iSide)
vZy = linspace(Zymin,Zymax,iSide)

mZ=zeros(iSide,iSide); # my matrix to fill

How can I fill this matrix ( not using 2 loops) from vectors ?



TIA

Adam


============ loop code =========

stepy = (Zymax - Zymin)/(iSide - 1); # pixel height
stepx = (Zxmax - Zxmin)/(iSide - 1); # pixel width

# scan all pixels of image and compute color
for iy = 1:iHalfSide
  Zy = Zymax - (iy-1)*stepy; # invert y axis
  for ix= 1:nx
    Zx = Zxmin + ix*stepx; # map from screen to world coordinate

  end
end



reply via email to

[Prev in Thread] Current Thread [Next in Thread]