I have written a program that does calculations using a given r and y-value, and have mostly got it ready.
The last thing I need to figure out is how to get a range of r and y values from my "data.txt" file.
The file includes the following values:
r y
5 6334
10 1674
15 522
20 135
25 47
30 18
35 4
40 1
I need it to read these numbers, assign the left column as r-values and the right as y-values.
My current program minimizes the chi-squared by changing 3 variables (A, T and L) for a given r and y. So it needs to take the list of values, and find the A, T and L value that will minimize the TOTAL chi-squared for all r and y-values.
If anyone could help me with reading and creating the array it would be a huge help. I've tried doing my own research, but everything online has so much assumed knowledge and I can't understand what I'm supposed to do.
This is what I have written
PROGRAM reader
IMPLICIT NONE
REAL, DIMENSION (8, 2) :: A
Integer r, y, data (8,16)
OPEN (8 , FILE = &
"C:\Users\stuab\Desktop\fortran\Project\DataReader\data.txt" &
,FORM = "FORMATTED", STATUS ="OLD")
READ (8, *) r , y
print *, "Matrix A" / (8F2.2), &
A ( r, y ), r = (8, 1), y = (8, 1)
END
Like I said, I don't understand what I'm supposed to write so this could make no sense for what I'm trying to do. I'm getting the message "Expecting a right parenthesis at the end of expression", and can't figure out why.