-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainwindow.h
86 lines (70 loc) · 1.74 KB
/
mainwindow.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QTimer>
#include <qwt_plot.h>
#include <qwt_plot_curve.h>
#include <qwt_plot_marker.h>
#include <qwt_symbol.h>
#include <qwt_plot_grid.h>
#define E_NUM 1
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
private:
Ui::MainWindow *ui;
QwtPlotCurve **curve;
QwtPlotMarker **mark;
QTimer *timer;
QwtPlotGrid *grid;
double **x, **y, **z;
double *w;
double d, a, mu, r;
double Tmin, Tmax, dt;
int count, num;
int t;
void solveStep(int i);
double dx(double *X, double *Y, double *Z, int k, int l)
{
if (k == num - E_NUM)
return -Y[k];
else
return -w[k] * Y[k] - Z[k];
}
double dy(double *X, double *Y, double *Z, int k, int l)
{
if (k == num - E_NUM)
return X[k] - mu * (1 - X[k] * X[k]) * Y[k];
else
{
double sync = 0;
for (int i = 0; i < num; ++i)
if ((x[i][l-1] - x[k][l-1]) * (x[i][l-1] - x[k][l-1])
+ (y[i][l-1] - y[k][l-1]) * (y[i][l-1] - y[k][l-1]) < r * r)
sync += d * (Y[i] - Y[k]);
return w[k] * X[k] + a * Y[k] + sync;
}
}
double dz(double *X, double *Y, double *Z, int k, int l)
{
if (k == num - E_NUM)
return 0;
else
return 0.1 + Z[k] * (X[k] - 8.5);
}
public slots:
void replot();
signals:
void stepChanged(int value);
private slots:
void on_pauseBtn_clicked();
void on_syncBox_clicked();
void on_muBtn_clicked();
};
#endif // MAINWINDOW_H