[求助]我编程时出现了一个我不会改的错误,谁帮我看看
<P>我在编程时在第41行出现一个错误,谁帮我看,错误提示是R,Q <br><FONT color=#f73809>Undefined function or variable "R".</FONT><br>%用基BP网络进行英文字符识别<br>close all<br>clear<br>echo on<br>clc<br>pause<br>clc</P><P><br>%载入训练样本<br>=prprob;<br>=size(alphabet);<br>=size(targets);<br>pause<br>clc<br>S1=10;<br>S2=R2;<br>net=newff(minmax(alphabet),,{'logsig' 'logsig'},'traingdx');<br>net.LW{2,1}=net.LW{2,1}*0.01;<br>net.b{2}=net.b{2}*0.01;<br>pause<br>clc<br>%训练神经网络<br>P=alphabet;<br>T=targets;<br>net.performFcn='sse';<br>net.trainParam.goal=0.1;<br>net.trainParam.show=20;<br>net.trainParam.epochs=5000;<br>net.trainparam.mc=0.95;<br>=train(net,P,T);<br>pause<br>clc</P>
<P>%netn=net;<br>%netn.trainParam.goal=0.6;<br>%netn.trainParam.epochs=300;<br>T=;<br>for pass=1:10<br> <STRONG><FONT color=#e66b1a>fprintf('Pass=%.0f\n',pass);<br> P =;<br> =train(netn,P,T);<br> echo off<br>end<br>echo on<br>pause<br>clc</P>
<P>netn.trainParam.goal=0.1;<br>netn.trainParam.epochs=500;<br>netn.trainParam.show=5;<br>P=alphabet;<br>T=targets;<br>=train(netn,P,T);<br>pause<br>clc</P>
<P>noise_range=0:.05:.5;<br>max_test=100;<br>network1=[];<br>network2=[];</P>
<P>for noiselevel=noise_range<br> fprintf('Testing networks with noise level of%.2f.\n',noiselevel);<br> errors1=0;<br> errors2=0;<br> for i=1:max_test<br> P=alphabet+rand(35,26)*noiselevel;<br> A=sim(net,P);<br> AA=compet(A);<br> errors1=errors1+sum(sum(abs(AA-T)))/2;<br> <br> An=sim(netn,P);<br> AAn=compet(An);<br> errors2=errors+sum(sum(abs(AAn-t)))/2;<br> echo off<br> end<br> network1=;<br> network2=;<br>end<br>echo on<br>pause<br>clc</P>
<P>plot(noise_range,network1*100,'--',noise_range,network2*100);<br>tille('Percentage of Recognition Errors(%)');<br>xlabel('Noise Level');<br>ylabel('Network 1-- Network 2--');<br>pause clc</P>
<P>noiseyB=alphabet(:,2)+randn(35,1)*0.2;</P>
<P>plotchar(noisyB);<br>pause<br>clc</P>
<P>A2=sim(net,noiseyB);<br>A2=compet(A2);<br>answer=find(compet(A2)==1);<br>plotchar(alphabet(:,answer));<br>pause<br>echo off<br>帮我改正,我感激不尽!!!</P>
[此贴子已经被作者于2006-6-3 17:14:04编辑过]
是不是R没有定义啊? 是的.但是R,Q代表干扰信号的输入,输出的维数.在执行时就是网络的输入,输出的维数.可以共享前面的定义.
[此贴子已经被作者于2006-6-3 17:24:10编辑过]
<P>即使要定义,如何定义,怎么样改才对啊??????</P> 要不你直接用具体数字代替R,Q吧 谢谢你的回答,我弄明白了,我应该在载入样本时定义一个=size(alphabet)<br>这样能调用prorob函数自动生成干扰信号.非常感谢版主的指导.
[此贴子已经被作者于2006-6-3 19:06:20编辑过]
^_^,自己搞懂才是最有成就的
回复:(fly)[求助]我编程时出现了一个我不会改的错误...
<P><FONT color=#ff0000>fly、ericlin加威望1点</FONT></P><P>多情清秋<BR>06.6.6</P>
页:
[1]