Fortran to matlab code

1 次查看(过去 30 天)
Matlabuser
Matlabuser 2014-11-12
评论: Matlabuser 2014-11-17
Hi everyone, I have a code in fortran and I want to convert that code in matlab. But problem is that, in fortran I have I=-N+1:N+1;
But in matlab, If I take the negative no. I have the problem of indexing. Can anyone please tell me, how I can solve this problem?
Thanks

采纳的回答

Torsten
Torsten 2014-11-12
If you mean
I=-(N+1):(N+1)
then shift the indices by N+2 for the MATLAB application.
Then in_Matlab I will be I=1:(2*N+3)
Best wishes
Torsten.
  2 个评论
Matlabuser
Matlabuser 2014-11-12
Thank you Torsten !!!
Matlabuser
Matlabuser 2014-11-17
a=-N+2
i=-N+1,N-1
p(i)=p(a)-p(a-2)
a=a+1
I did not know how to change this in matlab

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Fortran with MATLAB 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by