python3 matlabplot 和matlab 绘图对比

在这里插入图片描述

matlab 的计算效率 和 绘图速度要远快于 python3

matlab 默认的 绘图方式就是 x 为数组的索引值 y 为 数组的数值

python3 source code

import os
import matplotlib.pyplot as plt
import numpy as np
import struct

filename = "seq.bin"

file = open(filename, "rb")
st = os.stat("seq.bin")
print(f"seq.bin size {st.st_size}")

buf = file.read(st.st_size)
y = np.frombuffer(buf, dtype=np.uint16)
x = np.array(range(int(y.size/2)))

_y = []
for tmp in range(0, y.size, 2):
    _y.append((y[tmp] | y[tmp+1] << 16))


fig, axes = plt.subplots()
axes.plot(x, _y)
plt.show()

matlab code

[file, message] = fopen("seq.bin", "rb");

if file < 0
    disp(message);
else
    disp("open ok");
end

[data, size] = fread(file, "uint32");
filename = "dbeug.txt";

plot(data);
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值