Skip to content

Instantly share code, notes, and snippets.

@yarrr-ru
Created January 11, 2019 11:33
Show Gist options
  • Save yarrr-ru/2f1e5ba4c67d3b7fe602d178db69150f to your computer and use it in GitHub Desktop.
Save yarrr-ru/2f1e5ba4c67d3b7fe602d178db69150f to your computer and use it in GitHub Desktop.
x1=-1.0; x2=+1.0; y1=-1.5; y2=+4.5;
nx=7; ny=9;
step_x=(x2-x1)/(nx-1); step_y=(y2-y1)/(ny-1);
step_min = min(step_x,step_y);
[x,y]=meshgrid([x1:step_x:x2], [y1:step_y:y2]);
z= x.^3 + 5.*x.^2.*y + x - y.^3;
surf(x,y,z), title('PS. Press<enter>');
pause;
xx=reshape(x,1,nx*ny);
yy=reshape(y,1,nx*ny);
zz= xx.^3 + 5.*xx.^2.*yy + xx - yy.^3;
p=[xx; yy];
t=zz;
goal = 0.0371;
spread = 1.0*step_min;
net = newrb(p,t, goal,spread);
net.layers{1}.size
smlt=sim(net,p);
[zz' smlt']
smltr=reshape(smlt,ny,nx);
surf(x,y,smltr), title('AS. Press<enter>');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment