-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bd93286
commit a0986f9
Showing
4 changed files
with
97 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
program example | ||
use iso_fortran_env | ||
use fstats | ||
use fplot_core | ||
implicit none | ||
|
||
! Description: | ||
! This example uses rejection sampling to sample an F distribution. | ||
|
||
! Local Variables | ||
integer(int32), parameter :: npts = 10000 | ||
real(real64), parameter :: d1 = 1.0d2 | ||
real(real64), parameter :: d2 = 1.0d2 | ||
real(real64), parameter :: xmin = 0.0d0 | ||
real(real64), parameter :: xmax = 2.0d0 | ||
real(real64) :: x(npts) | ||
type(f_distribution) :: dist | ||
|
||
! Plot Variables | ||
type(plot_2d) :: plt | ||
type(plot_data_histogram) :: pd | ||
|
||
! Perform the sampling | ||
dist%d1 = d1 | ||
dist%d2 = d2 | ||
x = rejection_sample(dist, npts, xmin, xmax) | ||
|
||
! Plot the resulting distribution | ||
call plt%initialize() | ||
call pd%define_data(x) | ||
call pd%set_transparency(0.5) | ||
call plt%push(pd) | ||
call plt%draw() | ||
end program |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters