matlab第3卷

发布 2023-05-19 18:39:28 阅读 5403

20 —20 学年度第学期。

数学软件》试卷卷3

系别班级学号姓名。

一、写出下列语句或语句组的功能(2×5=10分)

1. help editpath

2. ezplot('cos(x)',0, pi])

3. a=; celldisp(a)

4. student=struct('name','wang','age',20)

5. p=[2 –5 6 –1 9];roots(p)

二、写出能完成指定功能的语句或语句组(3×5=15分)

1. 求函数的3阶导数。

2. 求极限。

3.求不定积分。

4. 求方阵的特征值和特征向量。

5.求解线性方程组。

三、1. 给下列程序加注释。写在“%”之后。(10分)

cleartheta=-pi:0.01:pi

rho(1,:)2*sin(5*theta).^2; %

rho(2,:)cos(10*theta).^3;

rho(3,:)sin(theta).^2;

rho(4,:)5*cos(3.5*theta).^3;

for i=1:4

subplot(2,2,i

polar(theta,rho(i

end2. 分析并描述下列程序的主要功能。

1)(5分)

function y=**erage(x);

m,n]=size(x);

if(~(m==1)|(n==1))|m==1 & n==1))

error('input must be a vector')

endy=sum(x)/length(x);

2)(5分)

x,y]=meshgrid([-4:0.5:4]);

z=sqrt(x.^2+y.^2);

surfc(x,y,z)

四、写程序,完成指定任务(10+12+13=35分)

1.绘制函数在的图形。要求:图形标题为“正弦函数”,轴名称为“自变量”,轴名称为“函数值”,并在处加文本标注“”。

2.编写函数实现求一个数是否为素数,再编写一主程序(脚本文件),要求通过键盘输入一个整数,然后调用判断素数函数,从而确定它是否为素数。

3.编函数计算1+(1+1/2)+(1+1/2+1/3)+.1+1/2+..1/n)

五、英译汉(10×2=20分)

subplot create axes in tiled positions.

h = subplot(m,n,p), or subplot(mnp), breaks the figure window into an m-by-n matrix of small axes, selects the p-th axes for for the current plot, and returns the axis handle. the axes are counted along the top row of the figure window, then the second row, etc.

you can enter matrices into matlab in several different ways.

start by entering dürer's matrix as a list of its elements. you h**e only to follow a few basic conventions:

separate the elements of a row with blanks or commas.

use a semicolon, ;to indicate the end of each row.

surround the entire list of elements with square brackets, [

MATLAB第3次实验

实验三绘图与可视化。一 实验目的。1.掌握普通二维和三维图形绘制及修饰控制方法 2.掌握饼图 条形图 三维网格曲面等图形绘制。二 实验原理。1.普通二维和三维图形绘制及修饰控制方法。二维图形绘命令 plot x1,y1,参数1 x2,y2,参数2 在同一坐标系中画多幅图形,x1 y1为第一条曲线x ...

MATLAB第3章MATLAB程序设计基础

第三章matlab程序设计基础。一,数据及数据文件。1.数据类型 字符数组 数值数组 单元数组 结构数组。j a类和函数句柄等 表 3 1 在工作空间浏览器中不同的数据类型有着不同的图标标识 图 3 2。2.数据文件。matlab支持的各种数据文件及其调用方法和返回值见 表 3 2 1 二进制数据文...

Matlab第3章学习概要

第3章学习概要。3.1什么是m文件?将m文件分成命令文件和函数文件的根据是什么?用matlab语言编写的程序,是m文件。调用方式的不同。3.2命令文件与函数文件的主要区别有哪些?1 命令文件没有输入参数,也不返回输出参数,而函数文件可以带输入参数,也可以返回输出参数。2 命令文件对matlab工作空...