Advertisement
TShiva

Лабораторная

Sep 21st, 2015
271
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scilab 2.87 KB | None | 0 0
  1. 1
  2. cos(tan(100+2.5*exp(1))-7.283)*0.51/(5+sin(8))
  3. 2
  4. s=((2*3+3*19)/2)*20
  5. 3.1
  6. for i=-2:0.1:-1
  7.     tan(7*i)
  8.     end
  9. 3.2
  10. for i=1.5:0.02:2.8
  11.     tan(7*i)
  12.     end
  13. 4.1
  14. A=zeros(3,4)
  15. B=ones(4,5)
  16. A(:,1)=A(:,1)+5
  17. A(:,2)=A(:,2)+6
  18. A(2,:)=A(2,:)+1
  19. A(3,:)=A(3,:)+7
  20. A(3,4)=-1
  21. 4.2
  22. A=zeros(3,4)
  23. B=ones(4,5)
  24. C=eye(4,5)
  25. B=B+C
  26. B(2,:)=B(2,:)-2
  27. B(:,2)=B(:,2)*3
  28. B(5,3)=0
  29. B(5,2)=0
  30. 4.3
  31. clc
  32. A=[2 3; 1 2]
  33. B=[11 12; 14 1]
  34. C=A*B
  35. C=B*A
  36. A.*B
  37.  
  38. 6
  39. clc
  40. function [t] = F(a,b)
  41. rand("uniform");
  42. t=0;
  43. for j=1:1:1000
  44.     k = rand(1,1);
  45.     if k<a | k>b then
  46.     t=t+1;
  47.     end
  48. end
  49.  
  50. endfunction
  51.  
  52. 7
  53. function [prime] = F(n);
  54. x=1;
  55. i=1;
  56. p=1;
  57. prime = [1,1];
  58. prove = 1;
  59. while i<=n
  60. for j=2:1:p
  61. if (pmodulo(p,j) == 0 & p <> j) then
  62. prove = 0
  63. end
  64. end
  65. if (prove == 1) then
  66. prime(1,i) = p
  67. i=i+1
  68. end
  69. p=p+1
  70. prove = 1
  71. end
  72. endfunction
  73.  
  74. 8
  75.  
  76. function [ruts] = F(n,m,f,d);
  77. ruts = roots(poly([n,m,f,d], 'x' , 'c'))
  78. endfunction
  79.  
  80. 9
  81.  
  82. alr=[1,2,2;
  83.      1,2,1;
  84.      1,1,2;
  85.      1,1,1];
  86. [alr1,k]=gsort(alr,'lr','i')
  87. [alr1,k]=gsort(alr,'lc','i')
  88.  
  89. 2й блок
  90.  
  91. clc
  92. // x=-%pi:0.05:%pi
  93. //    plot2d(x,3*cos(x), style = color('blue'),leg = 'Функция 3*cos(x)')
  94. //g.x_label.text='Ось абсцисс';      
  95. //g.y_label.text='Ось ординат';
  96. //g.children(1).children.line_style=6;
  97. //g.grid=[0 0];
  98. t=1:0.01:10
  99. x=t^2+3
  100. y=t+1
  101.  
  102. plot2d(x,y)
  103.  
  104.  
  105.  
  106. 3й блок
  107. 1
  108. A = [6 -8 1; 3 2 -3; 7 -1 5]
  109. b = [5;-2;3]
  110. C = rref([A b])
  111. [n,m] = size(C);
  112. x = C(:,m)
  113.  
  114.  
  115. A = [1 2 3; 4 5 6; 7 8 9]
  116. b = [1;2;3]
  117. C = rref([A b])
  118. [n,m] = size(C);
  119. x = C(:,m)
  120.  
  121. 2.1
  122. function [angle] = U(V1,V2)
  123.     angle = acos((V1(1)*V2(1)+V1(2)*V2(2)+V1(3)*V2(3))/(sqrt(V1(1)^2+V1(2)^2+V1(3)^2)*sqrt(V2(1)^2+V2(2)^2+V2(3)^2)))
  124. endfunction
  125.  
  126. 2.2
  127. function [len] = F(V);
  128. len = sqrt(V(1)^2+V(2)^2+V(3)^2);
  129. endfunction
  130.  
  131. 3
  132.  
  133. C = [1,2,5]'
  134. R = [0,4,2]
  135. angle = U(C,R)
  136. Oy = [0,1,0]
  137. angle = U(2*C'+R,Oy)
  138.  
  139. 4
  140.  
  141. function F = G(n);
  142.     F = [1,1]
  143. F(1) = 1;
  144. F(2) = 1;
  145. S = 2;
  146. for i=2:1:n-1
  147.     F(i+1) = F(i)+F(i-1);
  148.     S = S+F(i+1);
  149. end
  150. F(n+1) = S;
  151. endfunction
  152.  
  153. 5
  154.  
  155. function seq = F(n)
  156.     seq = [1,1]
  157.     seq(1) = 1;
  158.     seq(2) = 1;
  159.     for i = 2:1:n-1
  160.         seq(i+1) = 2*seq(i);
  161.     end
  162. endfunction
  163.  
  164. 6
  165.  
  166. 7
  167. V = [3,1,-8,-3,5; 3,5,2,1,1;1,2,-5,3,1]
  168. W = [1,1,1,1,1;-1,4,2,10,3;-3,-1,5,0,2]
  169. spaninter(V,W)
  170.  
  171. 8
  172.  
  173. 9
  174. X = 0:0.05:2*%pi;
  175. Y = X.*sin(X);
  176. function y =f(x), y = x.*sin(x), endfunction
  177. I = intg(0,2*%pi,f)
  178. plot2d(X,Y)
  179.  
  180. 11
  181.  
  182. deff('y=f(x)','y = 5-2*x-1/x')
  183. x1 = fsolve(0.3,f);
  184. x2 = fsolve(2.3,f);
  185. X= x1:0.01:x2;
  186. Y = 5-2*X;
  187. plot2d(X,Y)
  188. Y =(X).^(-1);
  189. plot2d(X,Y)
  190. function y = g(x), y = 5-2*x, endfunction
  191. function y = h(x), y = 1/x, endfunction
  192. I = intg(x1,x2,g)-intg(x1,x2,h)
  193.  
  194. 12
  195. x=-10:0.1:10
  196. y=2*x^2-3*x+1
  197. plot2d(x,y, style = color('blue'))
  198. y=(25-(x-3)^2)^(1/2)+1
  199. plot2d(x,y, style = color('blue'))
  200. y=-(25-(x-3)^2)^(1/2)+1
  201. plot2d(x,y, style = color('blue'))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement