import numpy as np
import os
import sys
import control as ctrl
import matplotlib.pyplot as plt
deflim_x(x, lim=0):
res =0if x > lim:
res =1else:
res =0return res
if __name__ =="__main__":print(__file__)
fc =20
Ts =50*10e-6
T =1/np.pi/2/fc
omega =2*np.pi*5/2
t = np.arange(0,2, Ts)
y = np.sin(omega*t)
ys =[lim_x(k)for k in y]
plt.close("all")
plt.figure("响应函数")
lowf = ctrl.tf([1],[T,1])
lowf_z = ctrl.c2d(lowf, Ts)
tout, yout = ctrl.forced_response(lowf_z, T=t, U=ys, X0=0)
plt.plot(tout, yout)
plt.plot(t, ys)
plt.legend(["input","output"])
plt.xlabel("time/s")
plt.show()# print(lowf, lowf_z)
计时器练习
namespace Ui {
class third;
}class third : public QWidget
{Q_OBJECTpublic:explicit third(QWidget *parent nullptr);~third();QLabel *labth1 new QLabel(this);QTextEdit *txtth1 new QTextEdit("闹钟",this);QLineEdit *leth1 new QLineEdit(t…
程序流程控制
1.顺序结构
程序从上至下逐行执行,无判断与跳转
public class Test1{ public static void main(String[] args){int i 1;int j i 1; System.out.println(j);}
}2.分支结构
依据条件,选择性执行某段语句 主要有以下两种
2.1 i…
1 单页面app
Step1:创建一个新的Python脚本。我们称之为uber_pickups.py。 Step2:在您喜爱的IDE或文本编辑器中打开uber_pickups.py,然后添加以下行:
import streamlit as st
import pandas as pd
import numpy as npStep3&…