Advertisement
elektryk798

octave_lab1

Mar 16th, 2017
394
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Octave 0.69 KB | None | 0 0
  1. %{
  2. a=32
  3. b=12
  4. function k = porownaj(a,b)
  5. if (a<b)
  6. k = -1 ;
  7. elseif (a>b)
  8. k = 1 ;
  9. else
  10. k = 0 ;
  11. end
  12. endfunction
  13. porownaj(a,b)
  14. %}
  15. %{
  16. x=[-5:0.01:5]
  17. function y= liczx(x)
  18. y=(x.^3)+(x.^2)-(3.*x)-3
  19. endfunction
  20. y=liczx(x)
  21. plot(x,y)
  22. %}
  23. %{
  24. A=rand(5)
  25. for k=A
  26. disp(A[1,k])
  27. endfor
  28. %}
  29. %{
  30. random = ones (1, 10);
  31. for i = 1:10
  32.   random(i) = rand(1);
  33. endfor
  34. random
  35. %}
  36.  
  37. %{
  38. slad=0
  39. random = rand (5, 5);
  40. for i = 1:5
  41.   for j=1:5
  42.   random(i,j) = round(random(i,j)*10);
  43.   if(i==j)
  44.     slad=slad+random(i,j);
  45.   endif
  46.   endfor
  47. endfor
  48. random
  49. slad
  50. %}
  51.  
  52. x=[-5:0.01:5]
  53. function y= liczx(x)
  54. if (x<0)
  55. y=sin(x);
  56. elseif (x<1)
  57. y=x.^2;
  58. else
  59. y=1;
  60. endif
  61. endfunction
  62. y=liczx(x)
  63. plot(x,y)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement