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
0 个评论
采纳的回答
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