Нарисовать график с кода этой программы С++ #include

#include

#define e 2.7

#define pi 3.14

using namespace std;

struct S

{

int T;

float deltaT;

int u0;

float k0;

float m;

int f0;

float h;

float C;

float tgDelta;

}

bool verifyStartEndTimePoint(float startValue, float endValue, float currentValue)

{

if (currentValue >= startValue || currentValue <= endValue)

return true;

return false;

}

float CalcU(const float u0, const float k0, const float m, float T, float k, float t)

{

float result;

if (verifyStartEndTimePoint(0, T / 4, t)) {

result = u0 * (1 - pow(e, (-k * t)));

}

else if (verifyStartEndTimePoint(T/4, T/2, t))

{

result = u0 * (1 - pow(e, (-k * (T / 4;

}

else if(verifyStartEndTimePoint(T / 2, T, t)) {

result = u0 * (1 - pow(e, (-k * t))) * pow(e, -k * (t - T / 2));

}

return result;

}

float CalcK(const float f0, const float k0, const float m, float T, float t)

{

float result;

if (verifyStartEndTimePoint(0, T / 2, t))

{

result = k0 * (1 + m*t);

}

else if (verifyStartEndTimePoint(T / 2, T, t)) {

result - k0 * (1 + m * (T / 2));

}

return result;

}

float CalcF(const float f0, const float h, float T, float t)

{

float result;

if (verifyStartEndTimePoint(0, T / 4, t))

{

result = f0 * (1 + h * t);

}

else if (verifyStartEndTimePoint(T/4, (3*T) / 4, t))

{

result = f0 * (1 + h * (T / 4));

}

else if (verifyStartEndTimePoint((3 * T) / 4, T, t))

{

result = f0 * (1 + h * (T / 4)) - f0 * pow(e, -h * (t - 3 / 4 * T));

}

return result;

}

float CalcP(float u, float f, float c, float tgDelta)

{

return pow(u, 2) * 2 * pi * f * c * tgDelta;

}

void GetInputData(vector vector, int T, float deltaT, int u0, float k0, float m, int f0, float h, float C, float tgDelta)

{

S s;

s.T = T;

s.deltaT = deltaT;

s.u0 = u0;

s.k0 = k0;

s.m = m;

s.f0 = f0;

s.h = h;

s.C = C;

s.tgDelta = tgDelta;

vector.push_back(s);

}

int main()

{

const int N = 3;

S strs[N];

/*GetInputData();

GetInputData();

GetInputData();*/

struct S2

{

float u;

float f;

float c;

float tgDelta;

float t;

};

tuple , int> Difference(vector s2, int t = 1)

{

vector finalval;

float currentP;

for (int i = 0; i <= 3; i++)

{

currentP = CalcP(s2[i].u, s2[i].f, s2[i].c, s2[i].tgDelta);

finalval.push_back(currentP);

}

return make_tuple(finalval, t++);

}

Kriiisskriiiis Kriiisskriiiis    2   15.07.2022 06:57    0

Другие вопросы по теме Информатика