From help-request at octave dot org Sat Jan 8 19:46:16 2005 Subject: multiplying Matrices and NDArrays (or HOWTO vectorize) From: Joan Picanyol To: help at octave dot org Date: Sun, 9 Jan 2005 02:48:49 +0100 [I'm working on simulating OFDM communications with antenna arrays, feel free to ask for background details should I not make myself clear] Hi, I'm getting "error: invalid conversion of NDArray to Matrix", and can't find a workaround. I was doing the following: ltmps = siso_channel(ps, pf_d, pSNR, 'none') lq = (1:model.array.Q)'; la = exp((-2i * pi * (lq - 1) * model.array.d / model.lambda ... * drop.theta)); ltmps = repmat(ltmps, model.array.Q, 1) .* la; octave-2.1.63:119> size(lq), size(drop.theta), size(la) ans = 3 1 ans = 1 500 ans = 3 500 to simulate the beamforming of an antenna array (la is the 'steering vector', containing the propagation delay between antenna elements), and ltmps has one row for each antenna element and one column for every discrete time interval. I know wanted to expand this to handle multipath, and to avoid a for loop I'd like to vectorize it using a 3D array, thus I generate a vector of random DoAs to be applied each to a different path: ldelta_theta = pi * (rand(1, 1, lnpaths) - 0.5) which I should add to drop.theta for every different path. After, I would add the contributions of lnpaths to get again a 3x500 matrix where different multipaths are coming from different angles. I have tried doing things like (ln_t is the length of the signal) la= exp((-2i*pi*(lq-1)*model.array.d/model.lambda*(repmat(drop.theta, [1 1 lnpaths]) + repmat(ldelta_theta, [1 ln_t 1])))) and trying element by element multiplication, but I can't come up with the proper formulation. What's the easy way of doing this? tks -- pica ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------