help-octave
[Top][All Lists]
Advanced

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

Re: Help filling an array


From: Søren Hauberg
Subject: Re: Help filling an array
Date: Sun, 27 May 2007 23:18:42 +0200
User-agent: Thunderbird 1.5.0.10 (X11/20070403)

Hi,
  So, you want to vectorize the following code:

Rob Teasdale skrev:
for i = 1:n
  m = limits(i,1);  % get the min limit index
  mx = limits(i,2); % get the max limit index
  imp(i,1) = [trapz(t(m:mx),p(m:mx))];
end

Is 'trapz' a matrix or a function in the above code? If it is a matrix then I don't think you can vectorize the code. Also is 't' and 'p' functions or matrices? The way your code looks, I can't think of a good vectorization, sorry :-( But if n is approx 10, then I don't really think solving this problem is worth your time. Since I'm answering this question to get away from writing my thesis I can understand that solving such problems are more fun then writing a thesis, but I think you should move on (I know I'll stop writing this mail, and get back to my thesis ;-) )

Søren


reply via email to

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