struna.cc
// Model struna.cc
// Problem: kmitani struny (SKRIPTA strana 42)
// reseni parcialni dif. rovnice, metoda primek
// (c) Petr Peringer, 1997
#include "simlib.h"
// parameters of simulation:
const double Print_Step = 0.001; // perioda vzorkování
const double Simul_Time = 0.05; // doba simulace
// equation
class Struna {
const unsigned N; // pocet useku
const double l; // delka
const double a; // koeficient (napeti ve strune ???)
const double b; // pocatecni vychylka uprostred struny
class Point : public aContiBlock {
Integrator v; // y'
Integrator y; // y
public:
Point() : v(), y(v) {}
double Value() { return y.Value(); }
void Set(Input i, double y0) {
v.SetInput(i);
y.Init(y0);
}
};
Point *y; // uzlove body
public:
Struna(unsigned _N, double _l, double _a, double _b) :
N(_N), l(_l), a(_a), b(_b) {
// konstrukce modelu:
y = new Point[N+1];
const double dx = l/N; // delka useku
const double adx2 = a/(dx*dx);
double xi = dx;
for(int i=1; i
Last modification:
If you have some suggestions to improve this page, please mail to
peringer AT fit.vutbr.cz