help-octave
[Top][All Lists]
Advanced

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

Arrays: Multidimensional manipulating


From: dirac
Subject: Arrays: Multidimensional manipulating
Date: Tue, 12 Apr 2011 09:22:50 -0700 (PDT)

Hi there,

I am having problems with a multidimensional array at the moment and have
looked online to see similar problems...

I basically have an equation

p = exp(-1*(a*(|k|^b)))

which I write:

p = exp(-1*abs(k).^b).

This is simple enough so far; if I want to vary a, k, and b, I could use for
loops or I could do it using a multidimensional array (what I want to do as
I assume it'll be faster). I started by defining vectors for a, b, and k:

k = [-20:0.05:20];
b = [0:0.01:2];
a = [0:0.001:0.01];


and then tried to find p for all of the possible values of a, b and k and
store in an array of three dimansion; I tried this:

p = zeros(length(a),length(k),length(b));   %allocating memory

p = exp(-1.*a.*(abs(k)).^b)

Which doesn't seem to work. 
Is this something that you can do with Octave or will I have to use for
loops?

Thanks in advance
Martin

-----
Still learning everyday.
--
View this message in context: 
http://octave.1599824.n4.nabble.com/Arrays-Multidimensional-manipulating-tp3445070p3445070.html
Sent from the Octave - General mailing list archive at Nabble.com.


reply via email to

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