Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- """
- Created on Fri Oct 25 22:30:56 2019
- @author: Bruker
- """
- import matplotlib.pyplot as plt
- def file_reader():
- data_file = open("ltspice_step_data.txt", "r")
- line = data_file.readline()
- values = line.split("\t")
- file_content = []
- line = data_file.readline()
- while line != "":
- file_content.append(line)
- line = data_file.readline()
- return file_content
- contents = file_reader()
- step_length = 77
- step_one = contents[1:85]
- step_two = contents[86:184]
- step_three = contents[185:271]
- time_s1 = []
- time_s2 = []
- time_s3 = []
- v_cap_s1 = []
- v_cap_s2 = []
- v_cap_s3 = []
- v_source = []
- for value in step_one:
- time_s1.append(float(value.split("\t")[0]))
- v_source.append(float(value.split("\t")[2]))
- print(float(value.split("\t")[1].strip("\n")))
- v_cap_s1.append(float(value.split("\t")[1].strip("\n")))
- for value in step_two:
- time_s2.append(float(value.split("\t")[0]))
- v_cap_s2.append(float(value.split("\t")[1].strip("\n")))
- for value in step_three:
- time_s3.append(float(value.split("\t")[0]))
- v_cap_s3.append(float(value.split("\t")[1].strip("\n")))
- plt.plot(time_s1, v_source)
- plt.plot(time_s1, v_cap_s1)
- plt.plot(time_s2, v_cap_s2)
- plt.plot(time_s3, v_cap_s3)
Advertisement
Add Comment
Please, Sign In to add comment