[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: newbie - matrix fill from vectors
From: |
Juan Pablo Carbajal |
Subject: |
Re: newbie - matrix fill from vectors |
Date: |
Thu, 3 Nov 2011 22:20:44 +0100 |
On Thu, Nov 3, 2011 at 9:28 PM, Adam Majewski <address@hidden> wrote:
> 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
>
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://mailman.cae.wisc.edu/listinfo/help-octave
>
What should be in mZ?
In your code you create Zy and Zx, but do not fill mZ.
--
M. Sc. Juan Pablo Carbajal
-----
PhD Student
University of Zürich
http://ailab.ifi.uzh.ch/carbajal/