データ解析ツールoctaveを語ろうat UNIX
データ解析ツールoctaveを語ろう - 暇つぶし2ch539:名無しさん@お腹いっぱい。
08/05/26 11:39:32
ついでなのでMATLABとの比較もします。MATLAB,Octaveで共通に動かせる用に小改変。
oregonator.mは
function dx = oregonator (A,B)
% Copyright (C) 1997, 1998, 2007 John W. Eaton
global octflag;
x=B;t=A;
if octflag,
x=A;t=B;
end;
dx = zeros (3, 1);
dx(1) = 77.27*(x(2) - x(1)*x(2) + x(1) - 8.375e-06*x(1)^2);
dx(2) = (x(3) - x(1)*x(2) - x(2)) / 77.27;
dx(3) = 0.161*(x(1) - x(3));
end;

bench1.mは
global octflag;
x0 = [ 4; 1.1; 4 ];
t=linspace(0,500,1000);
octflag=0;
if exist('OCTAVE_VERSION'),
octflag=1;
end;
tic
if octflag,
y = lsode ('oregonator', x0, t);
else
[tpts, y]= ode15s (@oregonator, t, x0);
end;
toc
plot (t,y);


次ページ
続きを表示
1を表示
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch