How can i make a training of square pulse to neural network ? how

when i am training a square wave to a neural network ,network reply response below
</matlabcentral/answers/uploaded_files/24263/111.JPG> figure 1 : response of training of network ; figure 2: square pulse train ; why don't have same network's response and pulse train? code: fs = 100000 t = 0:1/fs:5; x2 = square(2*pi*t); net = newff([-1.5 1.5],[5,1],{'logsig','purelin'}); net= train(net,t,x2); Y=net(x2); subplot(211) plot(t,Y) axis([0 5 -1.2 1.2]);
subplot(212) plot(t,x2)

1 件のコメント

Greg Heath
Greg Heath 2015 年 1 月 23 日
編集済み: Greg Heath 2015 年 1 月 23 日
Reformat so that the program will run when cut and pasted into the command line

サインインしてコメントする。

 採用された回答

Greg Heath
Greg Heath 2015 年 1 月 23 日

1 投票

% when i am training a square wave to a neural network , network reply response below % /matlabcentral/answers/uploaded_files/24263/111.JPG
% figure 1 : response of training of network ;
% figure 2: square pulse train ;
% why don't have same network's response and pulse train?
% code:
fs = 100000
t = 0:1/fs:5;
N = length(t) % 500,001
x2 = square(2*pi*t); % 0 <= 2*pi*t <= 31.416
net = newff([-1.5 1.5],[5,1],{'logsig','purelin'});
0. I don't have a toolbox with the square function. Therefore, I used x2 = sign(sin(2*pi*t))
1. You are trying to use a half of a million points to model a non-differentiable square wave over 5 periods.
2. For a sine wave
a. As few as ~12 points per period may be sufficient
b. At least 2 hidden node sigmoids are needed for each peak
3. You erroneously entered the input range to be [-1.5 1.5] instead of [ 0 5 ].
Hope this helps.
*Thank you for formally accepting my answer*
Greg

3 件のコメント

mahmoud shojaee
mahmoud shojaee 2015 年 1 月 23 日
編集済み: mahmoud shojaee 2015 年 1 月 23 日
Hi Greg,thank you that help me
I implement whatever you said;
I put:
fs = 1000;
x2 = sign(sin(2*pi*t));
net = newff([0 5],[10,1],{'logsig','purelin'});
net= train(net,t,x2);
but the network's response is in contrast phase or Vice Versa of main function *so thanks Mr.Heath
Greg Heath
Greg Heath 2015 年 1 月 23 日
Dr. Heath or Prof. Heath. However, I prefer Greg.
Label your plots Target and Output, respectively. Also increase the vertical range on the lower plot.
Greg
mahmoud shojaee
mahmoud shojaee 2015 年 1 月 24 日
graph with increasing
the vertical range on the lower plot.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeSignal Generation, Analysis, and Preprocessing についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by