-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
executable file
·33 lines (29 loc) · 962 Bytes
/
Copy pathmain.cpp
File metadata and controls
executable file
·33 lines (29 loc) · 962 Bytes
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
//The soft for simulating neural system.
#include <fstream>
#include <iostream>
#include <cmath>
#include "declareNeuralNetwork.h"
#include "fourthOrderRungeKutta.h"
int main(){
uint NumOfNeuronA = 1;//NeuronAの数
uint NumOfNeuronB = 1;//NeuronBの数
double dt = 0.0001;//タイムステップ
double totaltime = 100.0;//総シミュレーション時間
NeuralNetwork<double> Network(NumOfNeuronA,NumOfNeuronB);
std::ofstream fout("test0.dat");
double time;
for(int i = 0;(time = i*dt) < totaltime;++i){
if(i%100 == 0){//100ステップごとに出力
fout << time << " ";
for(auto itr = Network.getNeuronsp().begin(); itr != Network.getNeuronsp().end(); ++itr)
fout << **itr;
fout << std::endl;
}
fourthOrderRungeKutta(Network,dt);
}
fout << time << " ";
for(auto itr = Network.getNeuronsp().begin(); itr != Network.getNeuronsp().end(); ++itr)
fout << **itr;
fout << std::endl;
return 0;
}