
上QQ阅读APP看书,第一时间看更新
1.5 综合实例
本章实例主要演示在运算式中标点符号的作用,并演示使用工作区Workspace窗口菜单命令绘制变量之间的关系图。
【例1-1】 在命令行窗口中计算1+2+3+4+5+6+7+8+9的值,观察分号和续行符的使用方法以及ans变量的用法。

【例1-2】 利用工作区窗口,显示内存变量x和y之间的关系图形,其中变量x和y是由余弦曲线y=cosx形成的数据组。
(1)产生工作区变量
在命令行窗口中输入命令:

运行后,则在“Workspace”中显示内存变量x和y。
(2)变量选定
在“Workspace”中,单击所需绘图的变量x和y,则x和y在工具栏左边显示。
(3)绘图
选择“PLOTS”选项卡中的“area”选项,绘制区域图。
以上操作过程显示如图1-48所示,运行结果如图1-49所示。

图1-48 显示操作过程

图1-49 显示区域图