MatLab考试题题库(必做题)(带答案)(2)
2. (1) Using plot() function to plot the curves of
2[sin(2)cos3]e x y x x -=+ and sin x z x
= in the range of []2,2x ππ∈-, let their color are red and green respectively, and add the grid to the figure.
(2) Using fplot() function and ezplot() function to plot above-mentioned (上述的) curves respectively.
(1)x=-2*pi:pi/100:2*pi;
y=(sin(2*x)+cos(3*x)).*exp(-2*x);
z=sin(x)/x;
plot(x,y,’r ’,x,z,’g ’)
(2)fplot('[(sin(2*x)+cos(3*x)).*exp(-2*x), sin(x)/x]',[-2*pi 2*pi])
3. Plot the 3D mesh figure and 3D surface figure of the function
222/2(1)(,)9(1)e x y f x y x --+=-
in the range of 44x -≤≤ and 44y -≤≤, respectively.
x=-4:1/100:4;
y=-4:1/100:4;
z=9(1-x)^2*exp(-x ’^2/2-(y ’+1)^2)
mesh(x,y,z);
surf(x,y,z);
四.综合编程题(每小题11分,共22分)
1. Write a function program to compute the following function
1.8|2|!,()f1(x)34sin(2),i x i x x =?=?+?整数其他
and call this function program to compute the value of y=f1(-4)+f1(3)-f1(14.37) in main program or command window, there, ||!i shows the factorial (阶乘) of ||i .
提示:对x 取整的函数有fix(x), floor(x), round(x) 和ceil(x) .
fuction y=f1(x) %
if x-fix(x)= =0
y=prod(1:abs(2*x));
else
y=4*sin(2*x)+x^;
y=f1(-4)+f1(3)-f1
2. Write a program to compute the sample mean
1
1xbar ==n
i i x x n =∑, and the sample skewness (偏度)
31
1ske ()n
i i x x n ==-∑ . for the following three case:
(1) n and ],,,[21n x x x x Λ= exist in Workspace of Matlab. It is no any limit;
(2) n and ],,,[21n x x x x Λ= are unknown variables. Please input x by keyboard one by one, and give a mark of end the data input. Examinees can use loop statement and length() function and input() function, but cannot use mean()
function, std() function, and var() function directly (可以使用循环语句和length()函数、input()函数等进行编程,但不能直接使用mean()、std()和var()等函数).
(1)s=0;
for i=1:n
s=s+x(i);
end
xbar=s/n
m=0;
for i=1:n
m=m+(x(i)-xbar)^3;
end
ske=m/n
(2)x(1)=input('请输入x ');
i=1;s=0;
while(x(i)~='a')
s=s+x(i);
i=i+1;
x(i)=input('请输入x ,输’a’结束');
end
xbar=s/(i-1)
m=0;
for j=1:i-1
m=m+(x(i)-xbar)^3;
end
ske=m/(i-1)
三,
产生一个1x10的随机矩阵,大小位于(-5 5),并且按照从大到小的顺序排列好!(注:要程序和运行结果的截屏)
答案:
a=10*rand(1,10)-5;
b=sort(a,'descend')
1.请产生一个100*5的矩阵,矩阵的每一行都是[1 2 3 4 5]
2. 已知变量:A=’ilovematlab’;B=’matlab’, 请找出:
(A) B在A中的位置。
(B)把B放在A后面,形成C=‘ilovematlabmatlab’
3. 请修改下面的程序,让他们没有for循环语句!
A=[1 2 3; 4 5 6; 7 8 9];
[r c]=size(A);
for i=1:1:r
for j=1:1:c
if (A(i,j)>8 | A(i,j)<2)
A(i,j)=0;
end
end
end
4. 请把变量A=[1 2 3; 4 5 6; 7 8 9]写到文件里,写完后文件看起来是这样的
1 2 3 4 5 6 7 8 9
5.试从Yahoo网站上获得微软公司股票的2008年9月的每日收盘价。
6.编写M文件,从Yahoo网站批量读取至在2008年9月份的每日收盘价(提示:使用字符串函数)。
7. 将金牛股份(000937)2005年12月14日至2006年1月10日的交易记录保存到Excel中,编写程序将数据读入MATLAB中,进一步将数据读入Access数据库文件。
8.已知资产每日回报率为,标准差为,资产现在价值为亿,求5%水平下资产的10天在险价值(Var)。
=[1 2 3 4 5],b=a(1)*a(5)+a(2)*a(4)+a(3)*a(3)+a(4)*a(2)+a(5)*a(1).试用MATLAB中最简单的方法计算b,注意最简单哦。
1、求下列联立方程的解
3x+4y-7z-12w=4
5x-7y+4z+ 2w=-3
x +8z- 5w=9
-6x+5y-2z+10w=-8
求系数矩阵的秩;
求出方程组的解。
解:(1)
>> a=[3 4 -7 -12];
5 -7 4 2 ;
1 0 8 -5;
-6 5 -2 10];
c=[4; -3; 9;-8];
b=rank(a)
b = 4
(2)>> d=a\c
d = , , ,
即: x=;y= ;z= ;w=
2、设y=cos[+((3sinx)/(1+x^2))]把x=0~2π间分为101点,画出以x为横坐标,y为纵坐标的曲线;
…… 此处隐藏:1095字,全部文档内容请下载后查看。喜欢就下载吧 ……相关推荐:
- [小学教育]四年级综合实践活动课《衣物的洗涤》教
- [小学教育]2014半年工作总结怎么写
- [小学教育]20世纪外国文学专题综合试题及答案
- [小学教育]TS_1循环使用催化丙烯环氧化反应研究
- [小学教育]最实用的考勤签到表(上下班签到表)
- [小学教育]气候与生态建筑——以新疆民居为例
- [小学教育]二人以上股东有限责任公司章程参考样本
- [小学教育]2014届第一轮复习资料4.1,3美好生活的
- [小学教育]土方开挖、降水方案
- [小学教育]手绘儿童绘本《秋天的图画》(蜡笔)
- [小学教育]2002级硕士研究生卫生统计学考试试题
- [小学教育]环保装备重点发展目录
- [小学教育]金蝶K3合并报表培训教材
- [小学教育]岩浆岩试题及参考答案
- [小学教育]知之深爱之切学习心得
- [小学教育]第十二章 蛋白质的生物合成
- [小学教育]Chapter 2-3 Solid structure and basi
- [小学教育]市政道路雨季专项施工方案
- [小学教育]中国海洋大学2012-2013学年第二学期天
- [小学教育]教育心理学第3章-学习迁移
- 浅谈深化国企改革中加强党管企业
- 2006年中国病理生理学会学术活动安排
- 设计投标工作大纲
- 基于ARP的网络攻击与防御
- 2016届湖北省七市(州)教科研协作体高三
- Google_学术搜索及其检索技巧
- 2019-2020学年七年级地理下册6.3美洲教
- 城市道路可研报告
- 【名师指津】2012高考英语 写作基础技
- 6级知识点培训北京师范大学《幼儿智趣
- 注册会计师会计知识点:金融资产
- 新安装 500 kV 变压器介损分析与判断
- PS2模拟器PCSX2设置及使用教程.
- 医院药事管理与药剂科管理组织机构
- {PPT背景素材}丹巴的醉人美景,免费,一
- NAS网络存储应用解决方案
- 青海省西宁市六年级上学期数学期末考试
- 测量管理体系手册依据ISO10012:2003
- 洞子小学培养骨干教师工作计划
- 浅谈《牛津初中英语》的教材特点及教学




