SHARE
TWEET

Untitled

a guest Mar 1st, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. clc;
  2.  
  3. disp('Лабораторная работа №5');
  4.  
  5. disp('Задание 1');
  6.  
  7. for x=1:2:11
  8. y = sin(x)^3
  9. disp([x,y])
  10. end
  11. disp('****************************************')
  12.  
  13. disp('Задание 2');
  14.  
  15. s = 0;
  16. for x = 2:.5:8
  17. y = x^2+cos(x);
  18. s = s + y;
  19. end
  20. disp(s);
  21. disp('****************************************')
  22.  
  23. disp('Задание 3');
  24.  
  25. s = 0;
  26. k = 0;
  27.  
  28. for x =1:.4:5
  29. y = 0.03*x^2-sin(x)*cos(5*x);
  30. if y < 0 then
  31. s = s+y;
  32. k = k+1;
  33. end
  34. end
  35.  
  36. disp('Сумма:');
  37. disp(s)
  38. disp('Количество слагаемых:')
  39. disp(k)
  40. disp('******************************')
  41.  
  42. disp('Задание 4');
  43. s=0;
  44. while s<7
  45.      r = rand()
  46.      if (0.2<r)& (0.7>r) then  
  47.        disp(' ', +string(r))
  48.        s = s + r
  49.      end
  50. end
  51.  disp(string(s), "Значение суммы:")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top