Fortran to matlab code

2 views (last 30 days)
Matlabuser
Matlabuser on 12 Nov 2014
Commented: Matlabuser on 17 Nov 2014
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

Accepted Answer

Torsten
Torsten on 12 Nov 2014
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 Comments
Matlabuser
Matlabuser on 12 Nov 2014
Thank you Torsten !!!
Matlabuser
Matlabuser on 17 Nov 2014
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

Sign in to comment.

More Answers (0)

Categories

Find more on Fortran with MATLAB in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!