OpenCores
URL https://opencores.org/ocsvn/artificial_neural_network/artificial_neural_network/trunk

Subversion Repositories artificial_neural_network

[/] [artificial_neural_network/] [trunk/] [test_bench/] [octave/] [nn_ex.m] - Blame information for rev 8

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 8 jstefanowi
x_tr = 2*rand(1,10000)-1;
2
y_tr = sin(pi*x_tr);
3
 
4
 
5
PR = zeros(1,2);
6
PR(1,1) = min(x_tr);
7
PR(1,2) = max(x_tr);
8
 
9
SS = [2 3 1];
10
 
11
NET = newff (PR,SS,{"tansig" "tansig" "tansig"},"trainlm","learngdm","mse");
12
 
13
NET.trainParam.min_grad = 0;
14
NET.trainParam.epochs= 150;
15
NET = train(NET,x_tr,y_tr);
16
x_val = linspace(-1,1,100);
17
x_val = [x_val x_val x_val x_val x_val];
18
y_val = sim(NET, x_val);
19
 
20
 
21
plot(y_val,'.');
22
 
23
wb_gen(NET);
24
% system('mv wb_init.vhd ../src/wb_init.vhd')
25
 
26
fid = fopen('../data_in.txt','w');
27
fprintf(fid,'%f\n',x_val);
28
fclose(fid);
29
fid = fopen('../data_out_oct.txt','w');
30
fprintf(fid,'%f\n',y_val);
31
fclose(fid);

powered by: WebSVN 2.1.0

© copyright 1999-2019 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.