help-octave
[Top][All Lists]
Advanced

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

RE: newbie - matrix fill from vectors


From: William Krekeler
Subject: RE: newbie - matrix fill from vectors
Date: Thu, 3 Nov 2011 21:50:16 +0000


-----Original Message-----
From: address@hidden [mailto:address@hidden On Behalf Of Juan Pablo Carbajal
Sent: Thursday, November 03, 2011 4:21 PM
To: Adam Majewski
Cc: address@hidden
Subject: Re: newbie - matrix fill from vectors

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/
_______________________________________________
Help-octave mailing list
address@hidden
https://mailman.cae.wisc.edu/listinfo/help-octave

Adam

look at meshgrid. Some of the things you said imply that it may be part of what 
you are looking for.

Also because Zy and Zx don't interact they can be replaced with single line 
equivalents
Zy = Zymax - ((1:iHalfSide)-1).*stepy;
Zx = Zxmin + (1:nx)*stepx;

William Krekeler


reply via email to

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