subject1k和subject1v的形状相同
# -*- coding: utf-8 -*-
import scipy.io as sio
raw_K = sio.loadmat('Subject1K.mat')
raw_V = sio.loadmat('Subject1V.mat')
k = raw_K['Subject1K']
v = raw_V['Subject1V'] ls_col=['r','g','b','orange']
import matplotlib.pyplot as plt
import numpy as np # 画K
figk = plt.figure()
for i in range(9):
# 第一维数大小为9
ax = figk.add_subplot(3,3,i+1)
for j in range(4):
# 针对一页中的四列分别画一条曲线
ax.plot(k[i,:,j],ls_col[j])
figk.show() # 画V
figv = plt.figure()
for i in range(9):
ax = figv.add_subplot(3,3,i+1)
for j in range(4):
ax.plot(v[i,:,j],ls_col[j])
figv.show() #以3条曲线展示'Subject1K.mat'中内容的均值和标准差
fig_mean_k=plt.figure()
for i in range(4):
ax = fig_mean_k.add_subplot(2,2,i+1)
#kk是一个101*9的矩阵
kk=k[:,:,i].T
#求均值
ls_m = np.mean(kk,axis=1)
#标准差
ls_std = np.std(kk,axis=1)
ax.plot(ls_m,ls_col[i])
ax.plot(ls_m+ls_std,ls_col[i],linestyle='--')
ax.plot(ls_m-ls_std,ls_col[i],linestyle='--')
fig_mean_k.show()