[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:51:16 +0200 |
User-agent: |
Thunderbird 1.5.0.10 (X11/20070403) |
Hi,
Rob Teasdale skrev:
trapz is a function (trapezoidal rule for simple integration),
Of course, silly me for not realizing this.
whilst t and p are vectors that hold the time and pressure respectively.
Okay. I see that 'trapz' can handle matrix arguments:
X = [0:0.1:pi; 0:0.1:pi];
Y = sin(X);
trapz(X, Y, 2)
ans =
1.9975
1.9975
So, if 'm:mx' has the same length for all 'i' you should be able to
vectorize this. If not, then I don't think you can do (at least not
without rewritting 'trapz').
I did leave this this afternoon and finalised another chapter, so
> I am happy to get back to 'the fun bits!',
Lucky you ;-)
Søren