Hello! I'm just getting into Fortran coding and I'm trying to convert a Matlab program into Fortran. I understand that, more noticably for larger programs, Fortran compiles more quickly than Matlab. This will be useful for me in the future as I move into more elaborate problems. This program in Matlab solves and plots the 1D Heat equation using the Explicit Euler Method (Finite Difference). The Matlab code is as follows, excluding the plotting components:
u(i,1) = 100*sin(pi*x(i)/2);
u(i,k+1) = u(i,k) + 0.5*r*(u(i-1,k)+u(i+1,k)-2*u(i,k));
I've been able to define the parameters, timesteps, spatial steps, etc. I'm running into trouble converting these loops into Fortran. I'm using a GCC compiler with the "gfortran" command in the Terminal of my Mac, and my file types are .f95 . My only resources so far have been Google searches, so I'm hoping someone would be willing to walk me through the process of constructing these loops in Fortran.
Thank you so much!