Advertisement
Nikitka_36

NS L8

Apr 2nd, 2015
479
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.54 KB | None | 0 0
  1. clear;
  2. x = [0:0.05:1];
  3. a = 0.1;
  4. b = 0.36;
  5. c = 0.81;
  6. d = 0.15;
  7. y = a.*x.^3 + b.*x.^2 + c.*x + d
  8.  
  9. for i = 1:100
  10.      a = rand;
  11.      b = rand;
  12.      c = rand;
  13.      d = rand;
  14.      T(1,i) = a;
  15.      T(2,i) = b;
  16.      T(3,i) = c;
  17.      T(4,i) = d;
  18.      P(i,:)=a.*x.^3 + b.*x.^2 + c.*x + d;
  19. end;
  20. P=P';
  21. net =newff(minmax(P),[7 4], { 'tansig', 'purelin'},'trainlm');
  22. net.trainParam.epochs = 500;
  23. [net] = train(net,P,T);
  24. K = sim(net,y')
  25.  
  26. a = 0.9;
  27. b = 0.81;
  28. c = 0.87;
  29. d = 0.005;
  30.  
  31. y1 = a.*x.^3 + b.*x.^2 + c.*x + d;
  32. K = sim(net,y1')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement