0% found this document useful (0 votes)
9 views7 pages

Prova 2.odt PDF-job 1

Informática 1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views7 pages

Prova 2.odt PDF-job 1

Informática 1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Atividade Avaliativa 02 – Nota N1 – Gnuplot

Informática no Ensino de Física 1


Gabriel Martins Costa
John Carlos Trindade Freitas
Leonardo Ramos Luz

Questão 1 Letra a

aluno@labufg:~/Downloads$ gnuplot

GNUPLOT
Version 5.4 patchlevel 2 last modified 2021-06-01

Copyright (C) 1986-1993, 1998, 2004, 2007-2021


Thomas Williams, Colin Kelley and many others

gnuplot home: http://www.gnuplot.info


faq, bugs, etc: type "help FAQ"
immediate help: type "help" (plot window: hit 'h')

Terminal type is now 'qt'


gnuplot> set title "Grafico 01" # Define o titulo do grafico
gnuplot> set xlabel "Eixo X" # Define o nome do eixo X
gnuplot> set ylabel "Eixo Y" # Define o nome do eixo Y
gnuplot> set key outside # Coloca a legenda fora do grafico
gnuplot> set terminal png font ',15' # Define a fonte legÃvel para o gráfico

Terminal type is now 'png'


Options are 'nocrop enhanced size 640,480 font "arial,15.0" '
gnuplot> set output 'grafico.png' # Define o arquivo de saÃda
gnuplot>
gnuplot> # Define a função de regressão linear
gnuplot> f(x) = a*x + b
gnuplot>
gnuplot> # Realiza a regressão linear
gnuplot> fit f(x) 'dados1.dat' using 1:2 via a, b # Ajusta a função aos dados
iter chisq delta/lim lambda a b
0 7.6531980500e+03 0.00e+00 2.07e+01 1.000000e+00 1.000000e+00
1 2.1441307428e+03 -2.57e+05 2.07e+00 1.353270e+00 1.047421e+00
2 2.1242519077e+03 -9.36e+02 2.07e-01 1.328119e+00 2.013352e+00
3 2.1228290052e+03 -6.70e+01 2.07e-02 1.317978e+00 2.354659e+00
4 2.1228289874e+03 -8.37e-04 2.07e-03 1.317942e+00 2.355869e+00
iter chisq delta/lim lambda a b

After 4 iterations the fit converged.


final sum of squares of residuals : 2122.83
rel. change during last iteration : -8.37065e-09

degrees of freedom (FIT_NDF) : 48


rms of residuals (FIT_STDFIT) = sqrt(WSSR/ndf) : 6.65023
variance of residuals (reduced chisquare) = WSSR/ndf : 44.2256

Final set of parameters Asymptotic Standard Error


======================= ==========================
a = 1.31794 +/- 0.06517 (4.945%)
b = 2.35587 +/- 1.91 (81.05%)

correlation matrix of the fit parameters:


a b
a 1.000
b -0.870 1.000
gnuplot>
gnuplot> # Plota os dados e a linha de regressão
gnuplot> plot 'dados1.dat' using 1:2 with points title "Dados Iniciais", f(x) with lines title
"Regressao Linear" # Plota os dados como pontos e a regressão linear

Questão 01 Letra b

set title "Grafico 02" # Define o titulo do grafico


set xlabel "Eixo X" # Define o nome do eixo X
set ylabel "Eixo Y" # Define o nome do eixo Y
set key outside # Coloca a legenda fora do grafico
set terminal png font ',15' # Define a fonte do grafico
set output 'grafico2.png' # Define o arquivo de saida do grafico

# Definir as funcoes
f(x) = a*x**2 + b*x + c
g(x) = d*x**3 + e*x**2 + f*x + g

# Realizar o ajuste para as funcoes f(x) e g(x) usando o comando fit


fit f(x) 'dados1.dat' using 1:3 via a, b, c
fit g(x) 'dados1.dat' using 1:3 via d, e, f, g

# Plotar os dados e as funcoes ajustadas


plot 'dados1.dat' using 1:3 with points title "Dados Iniciais", \
f(x) with lines title "Regressao Quadratica", \
g(x) with lines title "Regressao Cubica"

*******************************************************************************
Thu Oct 31 15:12:26 2024

FIT: data read from 'dados1.dat' using 1:3


format = x:z
#datapoints = 50
residuals are weighted equally (unit weight)

function used for fitting: f(x)


f(x) = a*x**2 + b*x + c
fitted parameters initialized with current variable values

iter chisq delta/lim lambda a b c


0 6.6854703927e+07 0.00e+00 6.62e+02 1.000000e+00 1.000000e+00 1.000000e+00
6 4.5101243514e+02 -8.16e-06 6.62e-04 1.592548e-02 3.295544e-02 -4.743852e-01

After 6 iterations the fit converged.


final sum of squares of residuals : 451.012
rel. change during last iteration : -8.1566e-11

degrees of freedom (FIT_NDF) : 47


rms of residuals (FIT_STDFIT) = sqrt(WSSR/ndf) : 3.09774
variance of residuals (reduced chisquare) = WSSR/ndf : 9.59601

Final set of parameters Asymptotic Standard Error


======================= ==========================
a = 0.0159255 +/- 0.002353 (14.78%)
b = 0.0329554 +/- 0.1238 (375.7%)
c = -0.474385 +/- 1.369 (288.5%)

correlation matrix of the fit parameters:


a b c
a 1.000
b -0.969 1.000
c 0.760 -0.876 1.000

*******************************************************************************

Questão 01 Letra c

gnuplot> set title "Grafico 03"


gnuplot> set xlabel "Eixo X"
gnuplot> set ylabel "Eixo Y"
gnuplot> set key right top outside font ',12' # Posiciona a legenda a direita, fora do grafico, com
fonte menor
gnuplot> set terminal png font ',15'

Terminal type is now 'png'


Options are 'truecolor nocrop enhanced butt size 640,480 font "arial,15.0" '
gnuplot> set output 'grafico3.png'
gnuplot> set autoscale
gnuplot>
gnuplot> f(x) = a*x**3 + b*x**2 + c*x + d
gnuplot> g(x) = d*x**3 + e*x**2 + f*x + g
gnuplot>
gnuplot> fit f(x) 'dados1.dat' using 1:4 via a, b, c, d
iter chisq delta/lim lambda a b c d
0 4.4251540590e+03 0.00e+00 2.54e+01 -2.220981e-04 2.758578e-02 1.304940e+00
2.003892e-04
1 4.4251540515e+03 -1.68e-04 2.54e+00 -2.220990e-04 2.758547e-02 1.304966e+00
2.003900e-04
iter chisq delta/lim lambda a b c d

After 1 iterations the fit converged.


final sum of squares of residuals : 4425.15
rel. change during last iteration : -1.68166e-09

degrees of freedom (FIT_NDF) : 46


rms of residuals (FIT_STDFIT) = sqrt(WSSR/ndf) : 9.80811
variance of residuals (reduced chisquare) = WSSR/ndf : 96.199

Final set of parameters Asymptotic Standard Error


======================= ==========================
a = -0.000222099 +/- 0.0005888 (265.1%)
b = 0.0275855 +/- 0.04566 (165.5%)
c = 1.30497 +/- 1.007 (77.2%)
d = 0.00020039 +/- 5.992 (2.99e+06%)

correlation matrix of the fit parameters:


a b c d
a 1.000
b -0.987 1.000
c 0.921 -0.970 1.000
d -0.691 0.771 -0.883 1.000
gnuplot> fit g(x) 'dados1.dat' using 1:5 via d, e, f, g
iter chisq delta/lim lambda d e f g
0 4.3987089995e+02 0.00e+00 1.90e+01 2.003900e-04 -3.125525e-02 2.828780e-01 -
9.339102e-01
1 4.3987089987e+02 -1.81e-05 1.90e+00 2.003898e-04 -3.125528e-02 2.828782e-01 -
9.339101e-01
iter chisq delta/lim lambda d e f g

After 1 iterations the fit converged.


final sum of squares of residuals : 439.871
rel. change during last iteration : -1.81392e-10

degrees of freedom (FIT_NDF) : 46


rms of residuals (FIT_STDFIT) = sqrt(WSSR/ndf) : 3.09231
variance of residuals (reduced chisquare) = WSSR/ndf : 9.56241

Final set of parameters Asymptotic Standard Error


======================= ==========================
d = 0.00020039 +/- 0.0001856 (92.64%)
e = -0.0312553 +/- 0.01439 (46.06%)
f = 0.282878 +/- 0.3176 (112.3%)
g = -0.93391 +/- 1.889 (202.3%)

correlation matrix of the fit parameters:


d e f g
d 1.000
e -0.987 1.000
f 0.921 -0.970 1.000
g -0.691 0.771 -0.883 1.000
gnuplot>
gnuplot> plot 'dados1.dat' using 1:4 with points title "Dados Iniciais 01", \
> f(x) with lines title "Regressao para Dados 01", \
> 'dados1.dat' using 1:5 with points title "Dados Iniciais 02", \
> g(x) with lines title "Regressao para Dados 02"

Questão 02

leonardo@leonardo-Lenovo-IdeaPad-S145-15IKB:~$ ls
'Área de trabalho' Downloads Modelos Público Vídeos
Documentos Imagens Músicas snap
leonardo@leonardo-Lenovo-IdeaPad-S145-15IKB:~$ cd Downloads
leonardo@leonardo-Lenovo-IdeaPad-S145-15IKB:~/Downloads$ gnuplot

GNUPLOT
Version 6.0 patchlevel 0 last modified 2023-12-09
Copyright (C) 1986-1993, 1998, 2004, 2007-2023
Thomas Williams, Colin Kelley and many others

gnuplot home: http://www.gnuplot.info


faq, bugs, etc: type "help FAQ"
immediate help: type "help" (plot window: hit 'h')

Terminal type is now qt


gnuplot> set terminal pngcairo size 800,600 font ',15'

Terminal type is now 'pngcairo'


Options are ' background "#ffffff" enhanced font ",15" fontscale 1.0 size 800, 600 '
gnuplot> set output 'temperatura_tempo.png'
gnuplot>
gnuplot> set title "Temperatura X Tempo"
gnuplot> set xlabel "Tempo [fs]"
gnuplot> set ylabel "Temperatura [K]"
gnuplot>
gnuplot> # Plotando os dados com linhas e ajustando a cor e largura
gnuplot> plot 'dados2.dat' using 2:4 with lines lc 3 lw 2 title "Dados", \
> 'dados2.dat' using 2:4 smooth bezier lc rgb 'red' lw 2 title "Curva de Tendencia"
gnuplot>

You might also like