[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Need help with vectorizing the code
From: |
lan |
Subject: |
Need help with vectorizing the code |
Date: |
Sat, 13 Apr 2013 07:35:31 -0700 (PDT) |
Hello, everyone!
I want to avoid using "for" loop to calculate vector x.
I have the following schematic code.
Thank you for your attention
function xdot = octave2 (x, t);
Do something;
endfunction;
function xdot = octave2 (x, t);
Do something;
endfunction;
function dsi = dsigma();
Z= Matrix 100 x 100;
t = linspace(0, 100, 10000)';
x(1) = sum(sum(lsode("octave2", Z(1, 1:100), t)));
x(2) = sum(sum(lsode("octave2", Z(2, 1:100), t)));
x(3)= sum(sum(lsode("octave2", Z(3, 1:100), t)));
...
x(100)=sum(sum(lsode("octave2", Z(100, 1:100), t)));
dsi = x;
endfunction;
dsigma();
--
View this message in context:
http://octave.1599824.n4.nabble.com/Need-help-with-vectorizing-the-code-tp4651809.html
Sent from the Octave - General mailing list archive at Nabble.com.
- Need help with vectorizing the code,
lan <=