From 5ee716791bf7a8ca74c1670a6887a53ab92141f6 Mon Sep 17 00:00:00 2001 From: justanothercatgirl Date: Mon, 14 Apr 2025 00:34:52 +0300 Subject: added 218, 226, 234, 240 --- 226/Makefile | 18 ++++++++++++++++++ 226/README.md | 5 +++++ 226/compile_flags.txt | 4 ++++ 226/data | 8 ++++++++ 226/include | 1 + 226/main.cpp | 32 ++++++++++++++++++++++++++++++++ 226/plot.pdf | Bin 0 -> 142006 bytes 226/plots.gp | 24 ++++++++++++++++++++++++ 8 files changed, 92 insertions(+) create mode 100644 226/Makefile create mode 100644 226/README.md create mode 100644 226/compile_flags.txt create mode 100644 226/data create mode 120000 226/include create mode 100644 226/main.cpp create mode 100644 226/plot.pdf create mode 100644 226/plots.gp (limited to '226') diff --git a/226/Makefile b/226/Makefile new file mode 100644 index 0000000..224506f --- /dev/null +++ b/226/Makefile @@ -0,0 +1,18 @@ + +CFLAGS = -std=c++2c -mavx -Iinclude -ggdb + +.PHONY: all run_main clean gnuplot + +run: gnuplot + +gnuplot: plots.gp run_main + gnuplot $< &>/dev/null + +run_main: main + ./main + +main: main.cpp include/* + $(CXX) -o $@ $< $(CFLAGS) + +clean: + rm -fr main *.png *.plot diff --git a/226/README.md b/226/README.md new file mode 100644 index 0000000..96fd716 --- /dev/null +++ b/226/README.md @@ -0,0 +1,5 @@ + + +# Обработка <> прака + + diff --git a/226/compile_flags.txt b/226/compile_flags.txt new file mode 100644 index 0000000..34ae930 --- /dev/null +++ b/226/compile_flags.txt @@ -0,0 +1,4 @@ +-Iinclude +-std=c++2c +-mavx2 + diff --git a/226/data b/226/data new file mode 100644 index 0000000..629cedb --- /dev/null +++ b/226/data @@ -0,0 +1,8 @@ +U T1 T2 T3 sT1 sT2 sT3 T sT dU sdU vpr epr +2.1 575 539 610 63 99 74 ? ? 1 0.01 139 0.02 +2.26 647 651 671 78 64 71 ? ? 1 0.01 143 0.04 +2.4 882 886 872 76 84 99 ? ? 1.02 0.01 171 ? +2.54 1021 1079 1033 151 137 126 ? ? 1.03 0.02 193 ? +2.68 1089 1143 1121 157 87 88 ? ? 1.026 0.01 196 ? +2.82 1111 1160 1053 183 237 287 ? ? 0.997 0.03 206 ? +3.0 1109 1063 1089 251 242 265 ? ? 0.957 0.03 206 ? diff --git a/226/include b/226/include new file mode 120000 index 0000000..2225752 --- /dev/null +++ b/226/include @@ -0,0 +1 @@ +../libprakpp/include/ \ No newline at end of file diff --git a/226/main.cpp b/226/main.cpp new file mode 100644 index 0000000..9584e60 --- /dev/null +++ b/226/main.cpp @@ -0,0 +1,32 @@ +#include "include/praktable.hpp" +#include "include/prakphys.hpp" + +using table = prak::table; +using f64p = prak::pvalue; +using f64v = std::vector; +using vecarg = const std::vector &; +using argvec = const std::vector &; + +void ex1(std::string file) { + table t(file); + t .apply(prak::avg, {"T1", "T2", "T3"}, "T") + .apply([](vecarg a){ + return std::sqrt(std::pow(prak::stddev({a[0], a[1], a[2]}), 2) + + std::pow(prak::avg({a[3], a[4], a[5]}), 2)/3.0); + }, {"T1", "T2", "T3", "sT1", "sT2", "sT3"}, "sT") + .add_columns({"Tv", "sTv", "Te", "sTe"}) + .add_columns({"svpr", "sepr"}, 6e3) + .multiply_column("vpr", 1e3) + .multiply_column("epr", conv::eV_to_J) + .apply_function([](vecarg a){return prak::m_e * a[0] * a[0] / (2 * prak::k);}, {"vpr"}, {"svpr"}, "Tv", "sTv") + .apply_function([](vecarg a){return 2 * a[0] / prak::k;}, {"epr"}, {"sepr"}, "Te", "sTe") + .delete_cols({"svpr", "sepr", "sTe"}) + .write_plot("T(U).plot", "U", "T", "sT") + .write_plot("Tv(U).plot", "U", "Tv", "sTv") + .print(); +} + +int main() { + ex1("data"); + return 0; +} diff --git a/226/plot.pdf b/226/plot.pdf new file mode 100644 index 0000000..339cdf8 Binary files /dev/null and b/226/plot.pdf differ diff --git a/226/plots.gp b/226/plots.gp new file mode 100644 index 0000000..853d03d --- /dev/null +++ b/226/plots.gp @@ -0,0 +1,24 @@ +set term pngcairo size 2400, 2000 font "Arial,30" +set grid lw 4 + +f1(x) = a1*x + b1 +f2(x) = a2*x + b2 + +fit f1(x) 'T(U).plot' using 1:2:3 yerr via a1,b1 +a2=a1 +fit f2(x) 'Tv(U).plot' using 1:2:3 yerr via a2,b2 + +set output 'plot.png' +set title "Зависимость температур термоэлектронов от напряжения накала" +set xlabel "U, В" +set ylabel "T, К" +set key top left + +set xrange[2.09:3.01] + +plot 'T(U).plot' using 1:2:3 with yerrorbars title "Расчёт по программе" lc rgb("blue") pt 2 lw 5, \ + f1(x) lc rgb "red" lw 3 title "Расчёт по программе", \ + 'Tv(U).plot' using 1:2:3 with yerrorbars title "расчёт по v_{нв}" lc rgb("orange") pt 3 lw 5, \ + f2(x) lc rgb "green" lw 3 title "расчёт по v_{нв}" +#'T(U).plot' with lines smooth csplines lc rgb "red" lw 3 title "Расчёт по ", \ +#'Tv(U).plot' with lines smooth csplines lc rgb "green" lw 3 title "Расчёт по v_{нв}" -- cgit v1.2.3-70-g09d2