Advertisement
Guest User

plots200.py

a guest
Jun 19th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.60 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2. """
  3. Created on Tue Jun 12 11:55:12 2018
  4.  
  5. @author: janer
  6. """
  7.  
  8. import numpy as np
  9. import matplotlib.pyplot as plt
  10. from scipy import interpolate as itp
  11.  
  12.  
  13. data = np.loadtxt('Werte200.txt')
  14.  
  15. f = data[:,0]
  16. U0 = data[:,1]
  17. Uc = data[:,2]
  18. Ul = data[:,3]
  19. Ua = data[:,4]
  20. Ukr = data[:,5]
  21. I = (Ua/200)*1000
  22.  
  23. f_new = np.linspace(f.min(),f.max(), 10000)
  24. tckUc = itp.splrep(f, Uc, s=0)
  25. tckUl = itp.splrep(f, Ul, s=0)
  26. tckUa = itp.splrep(f, Ua, s=0)
  27. tckUkr = itp.splrep(f, Ukr, s=0)
  28. tckI = itp.splrep(f, I, s=0)
  29. Uc_new = itp.splev(f_new, tckUc, der=0)
  30. Ul_new = itp.splev(f_new, tckUl, der=0)
  31. Ua_new = itp.splev(f_new, tckUa, der=0)
  32. I_new = itp.splev(f_new, tckI, der=0)
  33. Ukr_new = itp.splev(f_new, tckUkr, der=0)
  34.  
  35.  
  36. plt.plot([488.678,488.678], [0.936,0], color ='red', linewidth=1.5, linestyle="--")
  37. plt.text(488,0,'f0',size = 15, color = 'red')
  38. plt.plot([419.063,419], [0.6874,0], color ='red', linewidth=1.5, linestyle="--")
  39. plt.text(419,0,'f1',size = 15, color = 'red')
  40. plt.plot([572.346,572.346], [0.6856,0], color ='red', linewidth=1.5, linestyle="--")
  41. plt.text(572,0,'f2',size = 15, color = 'red')
  42.  
  43.  
  44. plt.plot(f, Uc, 'b.')
  45. plt.plot(f_new, Uc_new, 'b-', label = 'Uc')
  46. plt.plot(f, Ul, 'g.')
  47. plt.plot(f_new, Ul_new, 'g-', label = 'Ul')
  48. plt.plot(f, Ua, 'y.')
  49. plt.plot(f_new, Ua_new, 'y-', label = 'Ua')
  50. plt.plot(f, Ukr, 'k.')
  51. plt.plot(f_new, Ukr_new, 'k-', label = 'Ukr')
  52. plt.plot(f, I, 'r.')
  53. plt.plot(f_new, I_new, 'r-', label = 'I')
  54. plt.xlabel('f / Hz')
  55. plt.ylabel('U / V')
  56. plt.title('Spannungskennlinien für Ra = 200 Ω')
  57. plt.legend(loc = 'upper right')
  58.  
  59. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement