Function in Fortran to Funciton in Matlab

1 回表示 (過去 30 日間)
Wazy sky
Wazy sky 2019 年 2 月 8 日
コメント済み: Wazy sky 2019 年 2 月 9 日
Hi,
Would be so much appreaciated if anyone can help with converiting the next code from fortran to Matlab. This code is part of larger one. this part is return the calculated F0 to the original code.
Thanks
FUNCTION F0(n,x)
INTEGER n
REAL F0,x
INTEGER j
REAL bk,bkm,bkp,tox,F00,F01
if (n.lt.2) pause 'bad argument n in F0'
tox=2.0/x
bkm=F00(x)
bk=F01(x)
do 11 j=1,n-1
bkp=bkm+j*tox*bk
bkm=bk
bk=bkp
11 continue
F0=bk
return
END

採用された回答

James Tursa
James Tursa 2019 年 2 月 8 日
編集済み: James Tursa 2019 年 2 月 8 日
function result = F0(n,x)
if( n<2 )
error('bad argument n in F0')
end
tox=2.0/x;
bkm=F00(x);
bk=F01(x);
for j=1:n-1
bkp=bkm+j*tox*bk;
bkm=bk;
bk=bkp;
end
result=bk;
return
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeFortran with MATLAB についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by