Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

pdfs2.sh 2.4 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
  1. #!/usr/bin/env bash
  2. # Testing gmt math for LPDF EPDF RPDF
  3. # Red dots are output from MATLAB (if available) for comparison
  4. ps=pdfs2.ps
  5. # Plot Laplace distribution
  6. gmt math -T-4/4/0.1 T LPDF = p.d
  7. cat << EOF > ML.txt
  8. EOF
  9. gmt psxy -R-4/4/0/0.5 -JX6i/1.2i -P -K p.d -W1p -BWS -Bxa1 -Byaf -Xc -Y0.75i --MAP_FRAME_TYPE=graph > $ps
  10. #gmt psxy -R -J -O -K ML.txt -Sc0.2c -Gred -N >> $ps
  11. gmt pstext -R -J -O -K -F+f12p,Times-Italic+cTR+jTR+t"Laplace P(z)" >> $ps
  12. # Plot Exponential distribution
  13. cat << EOF > ML.txt
  14. 0 2.000000000000000
  15. 1 0.270670566473225
  16. 2 0.036631277777468
  17. 3 0.004957504353333
  18. 4 0.000670925255805
  19. 5 0.000090799859525
  20. 6 0.000012288424707
  21. 7 0.000001663057438
  22. 8 0.000000225070349
  23. EOF
  24. gmt math -T0/8/0.1 T 2 EPDF = p.d
  25. gmt psxy -R0/8/0/2.5 -J -O -K p.d -W1p -BWS -Bxa1 -Byaf -Y1.65i --MAP_FRAME_TYPE=graph >> $ps
  26. gmt psxy -R -J -O -K ML.txt -Sc0.2c -Gred -N >> $ps
  27. gmt pstext -R -J -O -K -F+f12p,Times-Italic+cTR+jTR+t"Exponential P(@~l=2@~)" >> $ps
  28. # Plot Rayleigh distribution
  29. cat << EOF > ML.txt
  30. 0 0
  31. 1 0.606530659712633
  32. 2 0.270670566473225
  33. 3 0.033326989614727
  34. 4 0.001341850511610
  35. 5 0.000018633265860
  36. 6 0.000000091379878
  37. 7 0.000000000160281
  38. 8 0.000000000000101
  39. EOF
  40. gmt math -T0/8/0.1 T RPDF = p.d
  41. gmt psxy -R0/8/0/0.8 -J -O -K p.d -W1p -BWS -Bxa1 -Byaf --MAP_FRAME_TYPE=graph -Y1.65i >> $ps
  42. gmt psxy -R -J -O -K ML.txt -Sc0.2c -Gred -N >> $ps
  43. gmt pstext -R -J -O -K -F+f12p,Times-Italic+cTR+jTR+t"Rayleigh P(z)" >> $ps
  44. # Plot Weibull distribution
  45. cat << EOF > ML.txt
  46. 0 0
  47. 1 0.551819161757164
  48. 2 0.125382222603158
  49. 3 0.014387706241539
  50. 4 0.001006387883708
  51. 5 0.000046775274225
  52. 6 0.000001521835153
  53. 7 0.000000035924763
  54. 8 0.000000000631937
  55. EOF
  56. gmt math -T0/8/0.1 T 1 1.5 WPDF = p.d
  57. gmt psxy -R0/8/0/0.8 -J -O -K p.d -W1p -BWS -Bxa1 -Byaf --MAP_FRAME_TYPE=graph -Y1.65i >> $ps
  58. gmt psxy -R -J -O -K ML.txt -Sc0.2c -Gred -N >> $ps
  59. gmt pstext -R -J -O -K -F+f12p,Times-Italic+cTR+jTR+t"Weibull P(z,1,1.5)" >> $ps
  60. # Plot CHI2DIST distribution
  61. cat << EOF > ML.txt
  62. 0 0
  63. 1 0.151632664928158
  64. 2 0.183939720585721
  65. 3 0.167347620111322
  66. 4 0.135335283236613
  67. 5 0.102606248279873
  68. 6 0.074680602551796
  69. 7 0.052845420989057
  70. 8 0.036631277777468
  71. EOF
  72. gmt math -T0/8/0.1 T 4 CHI2PDF = p.d
  73. gmt psxy -R0/8/0/0.25 -J -O -K p.d -W1p -BWS+t"Probability Density Functions" -Bxa1 -Byaf --MAP_FRAME_TYPE=graph -Y1.65i >> $ps
  74. gmt psxy -R -J -O -K ML.txt -Sc0.2c -Gred -N >> $ps
  75. gmt pstext -R -J -O -F+f12p,Times-Italic+cTR+jTR+t"@~c@~@+2@+(z,@~n=4@~)" >> $ps
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...