Fortran Find peak in the historgram data file - FORTRAN

AI Thread Summary
To find the peak in a dataset of X Y values using Fortran, the initial approach involves opening the data file and reading the values into arrays. The key steps include using the MINVAL function to identify the lowest Y value, which indicates the peak, and MINLOC to locate its position in the array. There is a suggestion to clarify the definition of "peak," with a consideration of whether derivatives are necessary for a more precise identification of local minima or maxima. This indicates that the discussion may involve further analysis techniques beyond simple value comparison.
gaijin1
Messages
1
Reaction score
0
Hello guys,

I have a file with X Y values (separated by space)

I want to scan the data to find the PEAK in the file. (It will probably be a lowest Y point...)

How do I do this is Fortran?

Thank you,

Alexander
 
Technology news on Phys.org
Seems like...
Code:
OPEN(11,file='inputfile.dat',form='formatted')
DO n=1,nPts
  READ(11,*) x,y
END DO
peak_val = MINVAL(y)
peak_loc = MINLOC(y)
Can you elaborate a little more on this "peak" that you need to find? Do you need to take derivatives?
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I have a quick questions. I am going through a book on C programming on my own. Afterwards, I plan to go through something call data structures and algorithms on my own also in C. I also need to learn C++, Matlab and for personal interest Haskell. For the two topic of data structures and algorithms, I understand there are standard ones across all programming languages. After learning it through C, what would be the biggest issue when trying to implement the same data...

Similar threads

Replies
2
Views
1K
Replies
5
Views
5K
Replies
12
Views
3K
Replies
2
Views
2K
Replies
4
Views
2K
Replies
16
Views
3K
Replies
8
Views
4K
Replies
1
Views
1K
Replies
5
Views
2K
Replies
10
Views
2K
Back
Top