如何用python计算功率与时间图的上升时间、功率超调量和稳定时间

2024-09-28 01:28:35 发布

您现在位置:Python中文网/ 问答频道 /正文

我尝试在python中测量功率与时间(信号输出)图的上升时间、功率超调量和稳定时间。你知道一个python函数可以让我计算这3个参数吗?在

3个参数定义如下: 1上升时间=从“开启”功率输出值的10%到90%的时间 2%超调量=((最大功率值)-(最终“开启”功率值))/(最终“开启”功率值) 三。稳定时间=信号功率输出在稳态值x%范围内的时间

功率(振幅)与时间的关系图类似于Matlab stepinfo指南中的第1张图https://uk.mathworks.com/help/control/ref/stepinfo.html

我有一个带有功率和时间值的.csv文件,所以我将它们作为一个数据帧加载并绘制功率与时间的关系图。但从这张图中,我不知道如何计算我需要的3个参数

import numpy as np
import matplotlib.pyplot as plt
import csv
import pandas as pd


time = [] # initialise time array
power = [] # initialise power array

df_csv = pd.read_csv('PvsV_SOA_comma.csv') # loads .csv file as a pandas 
dataframe

time = df_csv.iloc[:, 0] # sets time array equal to data in 1st (index 
from 0) column of datafram, selecting all rows
power = df_csv.iloc[:, 1] # sets voltage array

plt.plot(time, voltage) 
plt.xlabel('Time (s)')
plt.ylabel('Power (W)')

Tags: csvimportdf参数time信号关系as

热门问题