0% found this document useful (0 votes)
4 views17 pages

GNUPlot Project File

The document outlines various gnuplot commands for plotting mathematical functions, including sine, cosine, tangent, and polynomial functions. It demonstrates how to set titles, labels, ranges, and output formats for graphs, as well as fitting data from a file. Additionally, it includes commands for creating parametric plots and exporting graphs as PNG images.

Uploaded by

Ishan Jaiswal
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views17 pages

GNUPlot Project File

The document outlines various gnuplot commands for plotting mathematical functions, including sine, cosine, tangent, and polynomial functions. It demonstrates how to set titles, labels, ranges, and output formats for graphs, as well as fitting data from a file. Additionally, it includes commands for creating parametric plots and exporting graphs as PNG images.

Uploaded by

Ishan Jaiswal
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

gnuplot> pl sin(x)

gnuplot> pl cos(x)
gnuplot> pl tan(x)

gnuplot> pl sin(x) lc 1 lw 2, cos(x) lc 2 lw 3, tan(x) lc 3 lw 4


gnuplot> pl sin(x+1) w p 1, sin(x) w p 2
gnuplot> set grid
gnuplot> f(x)=4*x-8
gnuplot> pl f(x)
gnuplot> f(x)=exp(-x*x/2)
gnuplot> pl f(x)
gnuplot> f(x)=exp(-x*x/2)
gnuplot> pl [-4:4] [0:1.1] f(x) w boxes lt 1 lw 3
gnuplot> set title "Gaussian Function"
gnuplot> set xlabel "x-axis"
gnuplot> set ylabel "f(x)"
gnuplot> f(x)=exp(-x*x/2)
gnuplot> pl [-4:4] [0:1.1] f(x) w boxes lt 1 lw 3
gnuplot> set title "Gaussian Function"
gnuplot> set xlabel "x-axis"
gnuplot> set ylabel "f(x)
gnuplot> set xrange [-4:4]
gnuplot> set yrange [0:1.1]
gnuplot> f(x)=exp(-x*x/2)
gnuplot> pl f(x)
gnuplot> f(x)=6*x+8
gnuplot> set xrange [1:10]
gnuplot> set yrange [10:70]
gnuplot> set xlabel "x values"
gnuplot> set ylabel "f(x)"
gnuplot> set title "f(x)=6x+8"
gnuplot> pl f(x)
gnuplot> f(x)=4*x**2+22*x+9
gnuplot> set xtics
gnuplot> set ytics
gnuplot> set zeroaxis
gnuplot> pl f(x)
gnuplot> f(x)=4*x**2+2*x-8
gnuplot> set zeroaxis
gnuplot> set xrange [20:50]
gnuplot> set yrange [1500:2000]
gnuplot> set xtics 30,10,50
gnuplot> set ytics 1500,50,2000
gnuplot> set xlabel "x values"
gnuplot> set ylabel "my function"
gnuplot> set title "f(x)= 4x^2 + 2x - 8"
gnuplot> pl f(x)
gnuplot> f(x) = 7*x-2
gnuplot> set xrange [1:10]
gnuplot> set yrange [1:70]
gnuplot> set xlabel "x values"
gnuplot> set ylabel "my function"
gnuplot> set title "f(x)=7x-2"
gnuplot> set xtics 5,1,10
gnuplot> set ytics 0,10,70
gnuplot> set zeroaxis
gnuplot> pl f(x) lc 2 lw 2
gnuplot> f(x)=x**3-4*x**2-8
gnuplot> set xrange [-10:15]
gnuplot> set yrange [-2000:2500]
gnuplot> set xlabel "x value"
gnuplot> set ylabel "my function"
gnuplot> set terminal png
Terminal type is now 'png'
Options are 'truecolor nocrop enhanced butt size 640,480 font "arial,12.0" '
gnuplot> set output "10.09.2025_1.png"
gnuplot> pl f(x) lt 7 lc 8 lw 1
gnuplot> f(x)= sin(x)**2 + 0.7*x
gnuplot> set xrange [-15:15]
gnuplot> set yrange [-1:2.2]
gnuplot> set xtics 2.2
gnuplot> set xzeroaxis
gnuplot> set label "x values"
gnuplot> set ylabel "sin(x)^2 + 0.7x"
gnuplot> set terminal png
Terminal type is now 'png'
Options are 'truecolor nocrop enhanced butt size 640,480 font "arial,12.0" '
gnuplot> set output "10.09.2025_2.png"
gnuplot> pl f(x) lt 1 lc 2 lw 2
gnuplot> set xrange [-6:6]
gnuplot> set yrange [-8:8]
gnuplot> set xlabel "x values"
gnuplot> set ylabel "hyperbolic function"
gnuplot> pl sinh(x) lc 1 lw 1, cosh(x) lc 2 lw 2, tanh(x) lc 3 lw 3
gnuplot> set terminal png
Terminal type is now 'png'
Options are 'truecolor nocrop enhanced butt size 640,480 font "arial,12.0" '
gnuplot> set output "10.09.2025_3.png"
gnuplot> repl
gnuplot> f(x)= m*x+c
gnuplot> set xrange [-2.0:8.0]
gnuplot> set yzeroaxis
gnuplot> fit f(x) 'data_Q4.txt' via m,c
iter chisq delta/lim lambda m c
0 5.6516950000e+02 0.00e+00 3.23e+00 1.000000e+00 1.000000e+00
1 1.1776932350e+01 -4.70e+06 3.23e-01 -1.140754e+00 9.650209e-01
2 2.0747155791e-02 -5.67e+07 3.23e-02 -1.680144e+00 2.748106e+00
3 4.9425402815e-04 -4.10e+06 3.23e-03 -1.698937e+00 2.851248e+00
4 4.9424752853e-04 -1.32e+00 3.23e-04 -1.698948e+00 2.851307e+00
5 4.9424752853e-04 -7.41e-09 3.23e-05 -1.698948e+00 2.851307e+00
iter chisq delta/lim lambda m c

After 5 iterations the fit converged.


final sum of squares of residuals : 0.000494248
rel. change during last iteration : -7.41451e-14

degrees of freedom (FIT_NDF) :3


rms of residuals (FIT_STDFIT) = sqrt(WSSR/ndf) : 0.0128355
variance of residuals (reduced chisquare) = WSSR/ndf : 0.000164749

Final set of parameters Asymptotic Standard Error


======================= ==========================
m = -1.69895 +/- 0.00209 (0.123%)
c = 2.85131 +/- 0.009315 (0.3267%)

correlation matrix of the fit parameters:


m c
m 1.000
c -0.788 1.000
gnuplot> set terminal png
Terminal type is now 'png'
Options are 'truecolor nocrop enhanced butt size 640,480 font "arial,12.0" '
gnuplot> set output "[Link]"
gnuplot> pl f(x)
gnuplot> set polar
dummy variable is t for curves
gnuplot> set xlabel "t values"
gnuplot> set ylabel "The Range"
gnuplot> set xzeroaxis
gnuplot> set label "Parametric Plot" at (-0.65,0.65)
gnuplot> set terminal png
Terminal type is now 'png'
Options are 'truecolor nocrop enhanced butt size 640,480 font "arial,12.0" '
gnuplot> set output "Parametric [Link]"
gnuplot> pl sin(2*t) lt 2 lc 6 lw 4, cos(2*t) lt 6 lw 2 lc 4

You might also like