一、 目的与任务
1.学习了解MATLAB语言环境; 2.练习MATLAB命令;
4.掌握SIMULINK工具箱的应用。 二、内容与要求 1.实验内容
(1)学习了解MATLAB语言环境; (2)练习MATLAB命令的基本操作;
(3)掌握SIMULINK仿真环境的使用方法; (4) 掌握线性系统仿真常用基本模块的用法 2.要求
按照实验文档的要求与步骤完成实验,撰写实验报告。 三、实验基本知识: 1.熟悉MATLAB环境:
MATLAB桌面和命令窗口、命令历史窗口、帮助信息浏览器、工作空间浏览器、文件和搜索路径浏览器。 2.掌握MATLAB常用命令
3.了解SIMULINK模块库中各子模块基本功能
四、上机练习
1. 学习使用help命令,例如在命令窗口输入help eye,然后根据帮助说明,学习使用指令eye(其它不会用的指令,依照此方法类推)
help eye
EYE Identity matrix.
EYE(N) is the N-by-N identity matrix.
EYE(M,N) or EYE([M,N]) is an M-by-N matrix with 1's on the diagonal and zeros elsewhere.
EYE(SIZE(A)) is the same size as A.
EYE with no arguments is the scalar 1.
EYE(M,N,CLASSNAME) or EYE([M,N],CLASSNAME) is an M-by-N matrix with 1's
of class CLASSNAME on the diagonal and zeros elsewhere.
Example:
x = eye(2,3,'int8');
See also SPEYE, ONES, ZEROS, RAND, RANDN.
Reference page in Help browser doc eye
x = eye(4,4,'int8')
x =
1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1
x=eye(2,3,'int8')
x =
1 0 0 0 1 0 help zeros
ZEROS Zeros array.
ZEROS(N) is an N-by-N matrix of zeros.
ZEROS(M,N) or ZEROS([M,N]) is an M-by-N matrix of zeros.
ZEROS(M,N,P,...) or ZEROS([M N P ...]) is an M-by-N-by-P-by-... array of zeros.
ZEROS(SIZE(A)) is the same size as A and all zeros.
ZEROS with no arguments is the scalar 0.
ZEROS(M,N,...,CLASSNAME) or ZEROS([M,N,...],CLASSNAME) is an M-by-N-by-... array of zeros of class CLASSNAME.
Example:
x = zeros(2,3,'int8');
See also EYE, ONES.
Reference page in Help browser doc zeros
x = zeros(2,3,'int8')
x =
0 0 0
0 0 0
2.任意创建3个变量,分别为数值、矩阵、字符串,保存到mydat.mat文件,再把my_data.mat文件中的变量读取到MatLab工作空间内;查找已创建变量的信息,删除变量;学习使用clc、clear,观察command window、command history和workspace等窗口的变化结果。
k=sym(3)
k = 3
z=[1,2;3,4]
z =
1 2 3 4 m=sym('me')
m = me
save mydate k m z load mydate k m z clear k find(k)
??? Undefined function or variable 'k'. find(z)
ans = 1 2 3 4
d:\\downloads\oolbox\\symbolic\\@sym\\fourier.m % sym method
4.在MATLAB指令窗中运行指令 (-32)^(1/5) 后,会得到 –2 吗? 532的全部方根有几个,并写出计算532全部方根的M脚本文件
(-32)^(1/5)
ans =
1.6180 + 1.1756i
a=[1,0,0,0,0,32]; roots(a)
ans =
-2.0000 -0.6180 + 1.9021i -0.6180 - 1.9021i 1.6180 + 1.1756i 1.6180 - 1.1756i
在历史指令窗中找到上述指令并选中点亮,单击鼠标右键选中{create M-file},并以exer0108为文件名保存,就得到了exer0108.m文件
7.SIMULINK仿真实际应用
d2xdx(0)2dx0x0在初始条件x(0)1, 1)利用SIMULINK求微分方程2(1x)dtdtdt情况下的解(mu=2,mu=100)。
2.521.510.50-0.5-1-1.5-2-2.5012345678910
1 mu=2
0.50-0.5-1-1.5-2-2.5
012345678910 mu=100
2)完成教材[例7.2-1]的simulink仿真。
因篇幅问题不能全部显示,请点此查看更多更全内容