Advertisement
Nikitka_36

NS L7

Apr 2nd, 2015
523
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.65 KB | None | 0 0
  1. clear;
  2. x = linspace(-10, 10, 50);
  3. Q = length(x);
  4. y = x.^3 - 8*x.^2;
  5. r = 10;
  6. t1=y+(rand(1,Q).*y*r/50-y*r/100);
  7. plot(x,y,x,t1,'r-');
  8. legend('первоначальная функция', 'с погрешностями', 2);
  9. title('Исходные функции');
  10.  
  11. net1 = newff(minmax(x), [3 1], {'tansig' 'purelin'});
  12. net1.trainParam.epochs;
  13. net1 = train(net1, x, t1);
  14. yf = sim(net, x);
  15. figure;
  16. plot(1:Q, yf,'k', 1:Q, t1,'r', 1:Q, y,'g');
  17. legend('сглаженная функция', 'с погрешностями','первоначальная функция',2);
  18. title('Сглаживание функции с помощью HC newff');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement