[Top][All Lists]

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

Re: Function of vector with meshgrid and surf

From: karl
Subject: Re: Function of vector with meshgrid and surf
Date: Fri, 20 Nov 2015 06:52:43 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

Am 12.11.2015 um 08:02 schrieb Sebastian Schöps:
karl wrote
function fr = frame1 (x)

Is it possible in this case, i.e. with no modification of frame1, to avoid
No. You will always need two iterations to evaluate all combinations of x
and y. However, these loops can be vecorized if your function allows it. In
your case it seems that only one of the two loops can be vectorized.

Please consider that the input of your function is a 11-by-22-MATRIX if you
try to vectorize both loops. Thus the following does not make sense (it
assumes that x is a 2-by-1 vector):

function fr = frame1 (x)

if you do not believe me, ask Octave:

function fr = frame1 (x)

View this message in context:
Sent from the Octave - General mailing list archive at

Help-octave mailing list
I have found now the solution. With "vec" one can transform the matrices X and Y into vectors, one can calcuulate the function
values with one command and then getting  the matrix  form of the function values with 

reply via email to

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