fork download
  1. import numpy as np
  2. import matplotlib.pyplot as plt
  3.  
  4.  
  5. # 生成时间序列
  6. t = np.linspace(0, 10, 1000)
  7.  
  8. # 模拟心电图波形(简单示例,由几个不同频率和幅度的正弦波叠加)
  9. ecg_wave = 1.5 * np.sin(2 * np.pi * 5 * t) + 0.5 * np.sin(2 * np.pi * 15 * t) + 0.2 * np.sin(2 * np.pi * 30 * t)
  10.  
  11. # 加入一些噪声模拟真实情况
  12. noise = np.random.normal(0, 0.1, len(t))
  13. ecg_wave += noise
  14.  
  15. # 绘制心电图波形
  16. plt.figure(figsize=(12, 6))
  17. plt.plot(t, ecg_wave, color='g')
  18. plt.title('Simulated Electrocardiogram (ECG)')
  19. plt.xlabel('Time (seconds)')
  20. plt.ylabel('Amplitude (mV)')
  21. plt.grid(True)
  22. plt.show()
  23.  
Success #stdin #stdout #stderr 3.47s 68980KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Fontconfig error: No writable cache directories