Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- amax = sin(t / 4.5 - x[0] / 2);
- for (i = 1; i < Nx + 1; i++)
- {
- a = sin(t / 4.5 - x[i] / 2);
- if (abs(a) > amax)
- amax = abs(a);
- }
- if (amax != 0)
- Ht = Hx / amax;
- else
- Ht = Hx;
- Uj1[0] = Mu(t);
- for (i = 0; i < Nx + 1; i++)
- {
- a = sin(t / 4.5 - x[i] / 2);
- aaa << a << "\n";
- gm = a * Ht / Hx;
- nn = 1;
- if (i == 0)
- nn = 0;
- if (i == Nx + 1)
- nn = 2;
- switch (nn)
- {
- case 0:
- if (gm < 0)
- Uj1[i] = (1 + gm) * Uj[i] - gm * Uj[i + 1];
- break;
- case 1:
- if (gm >= 0)
- Uj1[i] = (1 - gm) * Uj[i] + gm * Uj[i - 1];
- else
- Uj1[i] = (1 + gm) * Uj[i] - gm * Uj[i + 1];
- break;
- case 2:
- if (gm > 0)
- Uj1[i] = (1 - gm) * Uj[i] + gm * Uj[i - 1];
- else
- Uj1[i] = Uj[i];
- break;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement