help-octave
[Top][All Lists]
Advanced

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

Need help to vectorize code


From: t t
Subject: Need help to vectorize code
Date: Sat, 13 Apr 2013 18:40:19 +0400

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();
reply via email to

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