Advertisement
Guest User

L02 Metode

a guest
Oct 15th, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.32 KB | None | 0 0
  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. """
  4. Created on Tue Oct 15 08:21:46 2019
  5.  
  6. @author: student
  7. """
  8.  
  9. #def funkcija():
  10. #    print("hello")
  11. #    
  12. #funkcija()
  13. import numpy as np
  14.  
  15. #def kvadriranje(x):
  16. #    return x**2
  17. #
  18. #def potenciranje(x, y=2):
  19. #    return x**y
  20. #    
  21. #a = kvadriranje(5)
  22. #b = kvadriranje(150)
  23. #
  24. #l = np.linspace(10, 30, 100)
  25. #
  26. #l_kvadrirano = kvadriranje(l)
  27. #
  28. #x = potenciranje(2, 3)
  29.  
  30. import matplotlib.pyplot as plt
  31.  
  32. #x = np.array([5,10])
  33. #y = np.array([5,10])
  34. #
  35. #plt.plot(x, y, 'go-')
  36.  
  37. #x = np.linspace(0, 10, 1000)
  38. #y = np.sin(x)
  39. #
  40. ##plt.figure()
  41. ##plt.plot(x, y,'y.')
  42. ##plt.title("Graf")
  43. ##plt.xlabel("xos")
  44. ##plt.ylabel("y-os")
  45. ##plt.axhline(4, color = "red")
  46. ##plt.axis("equal")
  47. ##plt.xlim(1, 5)
  48. ##plt.ylim(-2,2)
  49. ##plt.grid()
  50. ##plt.savefig("plot")
  51. ##
  52. #def kvadriranje(x):
  53. #    return x**2
  54. ##
  55. #y2 = kvadriranje(x)
  56. ##plt.figure()
  57. ##plt.plot(x, y2, "r.")
  58. #
  59. #figure = plt.figure(constrained_layout = True)
  60. #
  61. #grid = figure.add_gridspec(3, 5)
  62. #
  63. #ax1 = figure.add_subplot(grid[0, :])
  64. #ax2 = figure.add_subplot(grid[1:, :-2])
  65. #ax3 = figure.add_subplot(grid[2, -2:])
  66. #
  67. #ax1.plot(x, y, "r.-")
  68. #ax2.plot(x, y2, "b-")
  69.  
  70.  
  71.  
  72. M = np.loadtxt("datoteka.txt", comments="$", delimiter = ", ")
  73.  
  74. M[3, :] = 140
  75. M[:, 1] = 123
  76.  
  77. np.savetxt("novadar.txt", M, delimiter="\t", )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement