【Matlab】matlab与matplotlib作图比较
来源:互联网 发布:excel表格数据取整 编辑:程序博客网 时间:2024/05/22 23:59
matlab与matplotlib作图比较
画图软件千千万,这个对比一下matlab与python的一个插件matplotlib作图质量。
直接上代码:
- matlab下的代码:
%幂函数x = linspace(-4,4,200);f1 = 10.^x;f2 = exp(x);f3 = 2.^x;plot(x, f1, 'r', x, f2, 'b', x, f3, 'g', 'LineWidth', 2);axis([-4, 4, -0.5, 8])text('Interpreter','latex','String','$10^x$', 'Position', [1, 7.5],'fontsize', 16)text('Interpreter','latex','String','$e^x$', 'Position', [2.2, 7.5],'fontsize', 16)text('Interpreter','latex','String','$2^x$', 'Position', [3.2, 7.5],'fontsize', 16)
- python下的代码:
import numpy as npimport matplotlib.pyplot as pltx = np.linspace(-4, 4, 200)f1 = np.power(10, x)f2 = np.power(np.e, x)f3 = np.power(2, x)plt.plot(x, f1, 'r', x, f2, 'b', x, f3, 'g', linewidth = 2)plt.axis([-4, 4, -0.5, 8])plt.text(1, 7.5, r'$10^x$', fontsize = 16)plt.text(2.2, 7.5, r'$e^x$', fontsize = 16)plt.text(3.2, 7.5, r'$2^x$', fontsize = 16)plt.show()
结果如下:
可以看到matlab画出来的图有更多的锯齿现象,python下matplotlib画出来的效果更好。
0 0
- 【Matlab】matlab与matplotlib作图比较
- MATLAB作图
- matlab 作图
- Python 之 Python与MATLAB 作图小结
- MATLAB作图方法与技巧(一)
- MATLAB作图方法与技巧(二)
- MATLAB作图方法与技巧(三)
- 《java与MATLAB混合编程》之《java调用MATLAB作图》
- MatLab作图基本
- matlab作图标记
- Matlab交互作图
- matlab函数作图
- matlab 三维作图
- Matlab作图语句小结
- matlab的作图
- matlab如何作图大全
- matlab三维作图知识点
- Matlab作图语句小结
- C++中volatile关键字
- 使用Android Studio打Andorid apk包的流程
- java中创建对象的方法(转)
- HDU3231Box Relations
- c++作业 4月10号
- 【Matlab】matlab与matplotlib作图比较
- 我的C++第三次上机作业
- 随机生成十个数,排顺序
- 组织部--EasyUI Combobox中getValue和getText
- Gulp部署
- SVN常用命令
- 看科比特如何成为工业级无人机新标杆
- 深入理解 Android 的 IPC 机制--------Binder
- JNI 开发笔记 - 基本概念