zoukankan      html  css  js  c++  java
  • Windows下绘制数学函数图像的方法

    一、安装相关软件

    1. 在Windows中安装VirtualBox;
    2. 在VirtualBox中安装Ubuntu Server;
    3. 在Ubuntu Server中安装cifs-utils:sudo apt-get install cifs-utils;
    4. 在Ubuntu Server中安装Octave:sudo apt-get install octave transfig epstool。


    二、在Windows和Ubuntu Server之间建立共享目录

    1. 在Windows中共享一个share文件夹,网络权限和目录全限全部设为Everyone & Full control;
    2. 在Ubuntu Server中建立映射目录:sudu mkdir /mnt/share;
    3. 在Ubuntu Server中挂载网络驱动器:sudo mount -t cifs //主机IP/share /mnt/share -o username=主机用户名;
    4. 在Ubuntu Server中的/home目录下建立快捷链接:ln -s /mnt/share/ ~/share/。


    三、绘图

    1. 在Windows中编写matlab绘图代码文件,放到共享文件夹中,例如文件test.m;
    2. 绘图代码中,plot语句的下面要将图像输出到文件:print -dpng myfig.png;
    3. 在Ubuntu Server中切换到共享目录:cd ~/share;
    4. 以静默方式运行octave:sudo octave -q test.m;
    5. 在Windows中可以看到共享目录下多了一个myfig.png,就是函数图像。

     一个测试例程:

    x = 0:pi/100:2*pi;
    y = tan(x);
    plot(x,y);
    print -dpng xab.png;

    附更改控制台分辨率方法:
    编辑配置文件,执行命令:sudo vi /etc/default/grub
    GRUB_GFXMODE=1024x768x24
    GRUB_CMDLINE_LINUX_DEFAULT="splash xvga=1024x768x24 consoleblank=0"
    # splash:开机和关机时显示图形画面
    # xvga=1024x768x24:屏幕分辨率和颜色深度
    # consoleblank=0:禁用屏保
    保存后执行命令:sudo update-grub2



    知识共享许可协议 作者:王雨濛;新浪微博:@吉祥村码农;来源:《程序控》博客 -- http://www.cnblogs.com/devymex/
    此文章版权归作者所有(有特别声明的除外),转载必须注明作者及来源。您不能用于商业目的也不能修改原文内容。
  • 相关阅读:
    第二周学习总结
    第一周学习进度总结
    淘宝网质量属性分析
    软件架构师如何工作
    寒假学习记录第十六天
    寒假学习记录第十五天
    寒假学习记录第十四天
    寒假学习记录第十三天
    三.NFS存储服务
    二.Rsync备份服务
  • 原文地址:https://www.cnblogs.com/devymex/p/4167354.html
Copyright © 2011-2022 走看看