Function in Fortran to Funciton in Matlab

1 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Fortran with MATLAB 的更多信息

Translated by