#include "TGraph.h" #include "TCanvas.h" #include #include static const double vref = 1.24; static const double rd = 24; static const double rv = 10; static const double rdd = 8; static const double rset = 39.9; void plot (double vmax) { double req = (vmax / vref - 1) / (1 / rd + 1 / rdd); double rt = 1 / (1 / req - 1 / rset - 1 / rv); printf("R_t = %.3e kOhm\n", rt); TGraph *g[5] = { new TGraph(), new TGraph(), new TGraph(), new TGraph(), new TGraph() }; for (int i = 0; i < 256; ++i) { double r = i / 256.0 * rv + 60e-3; double _rd[5] = { 0.8 * rd, 0.9 * rd, rd, 1.1 * rd, 1.2 * rd }; for (int j = 0; j < 5; ++j) { double rd = 1 / (1 / _rd[j] + 1 / rdd); double req = 1 / (1 / r + 1 / rt + 1 / rset); double v = vref * (rd + req) / rd; g[j]->SetPoint(i, r, v); } } for (int i = 0; i < 5; ++i) { g[i]->SetLineWidth(2); g[i]->SetLineStyle(1 + abs(i - 2)); g[i]->Draw(i ? "l" : "al"); if (!i) g[i]->GetXaxis()->SetTitle("R_{v} / k#Omega"); g[i]->GetYaxis()->SetTitle("V"); } gPad->SetGridx(); gPad->SetGridy(); }