help-octave
[Top][All Lists]
Advanced

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

Re: Help filling an array


From: Muthiah Annamalai
Subject: Re: Help filling an array
Date: Sun, 27 May 2007 16:51:34 -0500

IMHO quad() is the  fastest function for integration than most home-brewn
code, or even trapz I believe.
-Muthu


On 5/27/07, Rob Teasdale <address@hidden> wrote:
Hi Søren

Thanks for your response.  trapz is a function (trapezoidal rule for simple 
integration), whilst t and p are vectors that hold the time and pressure 
respectively. As I am (re)learning this style of language your term vectorize 
will help, and I will do some searching for methods on how to achieve this. I 
did leave this this afternoon and finalised another chapter, so I am happy to 
get back to 'the fun bits!',

Cheers
Rob

----- Original Message ----
From: Søren Hauberg <address@hidden>
To: Rob Teasdale <address@hidden>
Cc: address@hidden
Sent: Sunday, 27 May, 2007 10:18:42 PM
Subject: Re: Help filling an array

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





      
___________________________________________________________________________________
How would you spend $50,000 to create a more sustainable environment in 
Australia?  Go to Yahoo!7 Answers and share your idea.
http://advision.webevents.yahoo.com/aunz/lifestyle/answers/y7ans-babp_reg.html


_______________________________________________
Help-octave mailing list
address@hidden
https://www.cae.wisc.edu/mailman/listinfo/help-octave




reply via email to

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