时间:2023-04-21 12:18:02 | 来源:网站运营
时间:2023-04-21 12:18:02 来源:网站运营
安装/编译 GNU Octave替代Matlab:GNU Octave[1] 是 MATLAB 最著名最为接近的替代品。它力求兼容, MATLAB 开发的项目很多都可以直接在 Octave 中运行。sudo apt-get install octave
全套的GNU Octave软件被分成了几个软件包,如果希望获得全套的特性,还需要额外安装如下一些软件包。如文档方面的包 octave-doc, octave-info, 和 octave-htmldoc,开发者的包 liboctave-dev
,以及调试包octave-dbg,都可以参考上述命令执行安装。Ubuntu 版本:Ubuntu 22.04 LTSCPU版本: Intel® Core™ i7-8650U CPU @ 1.90GHz × 8
cp ~/Downloads/octave-7.1.0.tar.xz ~/Octavecd Octavetar -xf octave-7.1.0.tar.xz
3. 为了编译,需要安装依赖环境和工具很多,可以利用如下命令可以直接完成,在命令行运行:sudo apt-get install gcc g++ gfortran make libblas-dev liblapack-dev libpcre3-dev/ libarpack2-dev libcurl4-gnutls-dev epstool libfftw3-dev fig2dev libfltk1.3-dev/ libfontconfig1-dev libfreetype6-dev libgl2ps-dev libglpk-dev libreadline-dev/ gnuplot-x11 libgraphicsmagick++1-dev libhdf5-dev openjdk-11-jdk libsndfile1-dev/ llvm-dev texinfo libgl1-mesa-dev pstoedit portaudio19-dev libqhull-dev libqrupdate-dev/ libsuitesparse-dev texlive-latex-extra libxft-dev zlib1g-dev autoconf automake bison/ flex gperf gzip icoutils librsvg2-bin libtool perl rsync tar qtbase5-dev qttools5-dev/ qttools5-dev-tools libqscintilla2-qt5-dev libsundials-dev
以上命令看着非常复杂,其实就是安装编译用的各种软件包如下表所示:依赖环境配置 | 描述 | License / 版权 |
---|---|---|
Autoconf | 软件配置工具 | GNU GPL v3.0 |
Automake | Makefile generator | GNU GPL v3.0 |
C++, C, and Fortran compilers | 编译c,c++和Fortran语言的编译器 | GNU GPL v3.0 |
GNU Make | Makefile processor | GNU GPL v3.0 |
Libtool | 库文件工具 | Free Software Foundation |
Unix utilities: gawk, gperf, less, ncurses | 各类系统工具 | GNU GPL v3.0 |
Bison | Bison命令解释器 | GNU GPL v3.0 |
Flex | 词法分析器 | The Flex project |
[sudo] password for XXX: Reading package lists... DoneBuilding dependency tree... DoneReading state information... Done......【这里耗费很长时间】...... Processing triggers for desktop-file-utils (0.26-1ubuntu3) ...Processing triggers for hicolor-icon-theme (0.17-2) ...Processing triggers for gnome-menus (3.36.0-1ubuntu3) ...Processing triggers for libc-bin (2.35-0ubuntu3) ...Processing triggers for tex-common (6.17) ...Running updmap-sys. This may take some time... done.Running mktexlsr /var/lib/texmf ... done.Building format(s) --all. This may take some time... done.
3. 成功后,运行编译和安装,在命令行运行:mkdir .build && /cd .build && /./../configure --prefix=$HOME/my_octave && /make -j2 && /make check && /make install
运行情况如下:checking for a BSD-compatible install... /usr/bin/install -cchecking whether build environment is sane... yeschecking for a race-free mkdir -p... /usr/bin/mkdir -pchecking for gawk... gawkchecking whether make sets $(MAKE)... yes.... 【这里耗费很长的时间】 .... lnames=`/usr/bin//sed -n -e "s/library_names='/([^']*/)'//1/p" < $f`; / if [ -n "$lnames" ]; then / rm -f $f $lnames $dl; / fi /done/usr/bin/mkdir -p /home/yacc/my_octave/share/octave/7.1.0/etc/usr/bin/install -c -m 644 ./../libinterp/DOCSTRINGS /home/yacc/my_octave/share/octave/7.1.0/etc/built-in-docstringsmake[4]: Leaving directory '/media/yacc/data1/octave-7.1.0/.build'make[3]: Leaving directory '/media/yacc/data1/octave-7.1.0/.build'make[2]: Leaving directory '/media/yacc/data1/octave-7.1.0/.build'make[1]: Leaving directory '/media/yacc/data1/octave-7.1.0/.build'
3. 安装完毕后,会在home目录下生成一个my_octave 目录,到~/my_octave/bin 目录下行运命令:./octave
没有配置路径,所以需要注意 "./" 不能省略,后续需要配置路径文件一方便运行,运行结果如下:x = linspace(-2,2,20); y = x'; z = x .* exp(-x.^2 - y.^2);Then, create a surface plot.surf(x,y,z)
弹出3D图像,搞定!关键词:替代,编译,安装