版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、广东技术师范学院天河学院控制系统仿真课程设计系 别: 电气工程系 班 级: 本电气112班 学 号: 学生姓名: 指导老师: 李颖琼 2014 年 10 月目录1 Matlab 软件简介31.1 MATLAB产生的历史背景312 MATLAB的语言特点和开发环境42课程设计内容53心得体会:134参考文献:145附录:(计算器程序)151 Matlab 软件简介1.1 MATLAB产生的历史背景MATLAB 是美国MathWorks公司出品的商业数学软件,用于算法开发、数据可视化、数据分析以及数值计算的高级技术计算语言和交互式环境,主要包括MATLAB和Simulink两大部分。 MATLAB
2、是矩阵实验室(Matrix Laboratory)的简称,和Mathematica、Maple并称为三大数学软件。它在数学类科技应用软件中在数值计算方面首屈一指。MATLAB可以进行矩阵运算、绘制函数和数据、实现算法、创建用户界面、连接其他编程语言的程序等,主要应用于工程计算、控制设计、信号处理与通讯、图像处理、信号检测、金融建模设计与分析等领域。MATLAB的基本数据单位是矩阵,它的指令表达式与数学、工程中常用的形式十分相似,故用 MATLAB来解算问题要比用C,FORTRAN等语言完成相同的事情简捷得多,并且mathwork也吸收了像Maple等软件的优点,使MATLAB 成为一个强大的数
3、学软件。在新的版本中也加入了对C,FORTRAN,C+ ,JAVA的支持。可以直接调用,用户也可以将自己编写的实用程序导入到MATLAB函数库中方便自己以后调用,此外许多的MATLAB爱好者都编写了一些经典的程序,用户可以直接进行下载就可以用。MATLAB的应用:利用MATLAB可以进行以下各种工作l 数值计算l 数值和符号计算l 工程和科学绘图l 控制系统的设计与仿真l 数字图像处理l 数字信号处理l 通讯系统设计与仿真l 财务与金融工程12 MATLAB的语言特点和开发环境 MATLAB作为一种科学计算的高级语言之所以受欢迎,就是因为它有丰富的函数资源和工具箱资源,编程人员可以根据自己的需
4、要选择函数,而无需再去编写大量繁琐的程序代码,从而减轻了编程人员的工作负担。被称为第四代编程语言的MATLAB最大的特点就是简洁开放的程序代码和直观实用的开发环境。具体地说MATLAB主要有以下特点: (1)库函数资源丰富(2)语言精炼,代码灵活 (3)运算符多而灵活(4)面向对象控制功能优良,使界面编程更方便、自由。(5)程序设计自由(6)图形功能强大(7)程序的兼容性好(8)源代码开放(9)形形色色的工具箱2课程设计内容实训一 熟悉MATLAB集成环境与基础运算(例子)2已知 ,求下列表达式的值:l A+6*B和A-B+I(其中I为单位矩阵)l A*B和A.*Bl A3和A.3l A/B及
5、BA解:A=12,34,-4;34,7,87;3,65,7B=1,3,-1;2,0,3;3,-2,7 I=eye(3) A+6*B A-B+I A-B+I A*B A.*B A.3 A/B BA得:A = 12 34 -4 34 7 87 3 65 7B = 1 3 -1 2 0 3 3 -2 7I = 1 0 0 0 1 0 0 0 1ans = 18 52 -10 46 7 105 21 53 49ans = 12 31 -3 32 8 84 0 67 1ans = 12 31 -3 32 8 84 0 67 1ans = 68 44 62 309 -72 596 154 -5 241an
6、s = 12 102 4 68 0 261 9 -130 49ans = 1728 39304 -64 39304 343 658503 27 274625 343ans = 16.4000 -13.6000 7.6000 35.8000 -76.2000 50.2000 67.0000 -134.0000 68.0000ans = 109.4000 -131.2000 322.8000 -53.0000 85.0000 -171.0000 -61.6000 89.8000 -186.2000实训二 MATLAB编程基础1 求100,999之间能被21整除的数的个数解:a=100:999b=(
7、rem(a,21)=0)c=find(b)'d=length(c)得:d = 437 分别对符号矩阵的两个变量求微分。解:A=sym('2*x,t2;t*sin(x),exp(x)')A1=diff(A,'x'); A2=diff(A,'t'); disp('dA/dx=');disp(A1); disp('dA/dt=');disp(A2);得:A = 2*x, t2 t*sin(x), exp(x)dA/dx= 2, 0 t*cos(x), exp(x)dA/dt= 0, 2*t sin(x), 0实训
8、三 MATLAB图形系统4绘制分段函数提示:用逻辑表达式求分段函数值。解:t=0:0.5:2.5y=t.2.*(t>=0)&(t<1)+(t.2-1).*(t>=1)&(t<2)+(t.2-2*t+1).*(t>=2)&(t<3)plot(t,y);得:实训四 SIMULINK仿真控制系统实验1 利用SIMULINK仿真来实现摄氏温度到华氏温度的转化:(范围在-10100解:实训五 MATLAB仿真控制应用实验一数值计算应用1求三元非线性方程的解。(提示:solve)2 试求的极限解:(1)syms x y z;x,y,z=solve
9、('x2+2*x+1=0','x+3*z=4','y*z=-1')得:x =-1y =-3/5 z = 5/3解(2)syms x kf=(1-1/x)k*x L=limit(limit(f,x,0),k,x)得:f =(1-1/x)k*xL =0三、电力电子技术 1设计单相桥式全控整流电路,变压器一次侧电压220V,变比n1:n2=1:2;电阻为10,用示波器观察变压器一二次侧及负载上的电压。(验证阻性感性负载电压波形)2设计三相桥式全控整流电路2:实训六 MATLAB仿真控制综合应用1. 设计一个计算器,要求有数字按钮,至少实现加减乘除四则混
10、合运算,实现显示。解3心得体会:通过这次MATLAB的课程设计,我对MATLAB有了一个更深的理解,matlab具有数值分析.矩阵计算.科学数据可视化以及非线性动态系统的建模和仿真等诸多功能。 这次的Matlab课程设计对我来说是一次挑战,之前课上学的知识都忘得差不多了,再加上对语言不怎么熟悉,想要编写复杂的代码,难度不是一点点,所以只有通过上网查资料,请教同学,巩固之前学的理论知识,回忆前面所做过的程序代码,也许能完成这次任务。 第一个实训题目,刚刚上手觉得还行,自己琢磨琢磨也能出结果,但后面实训题目压根没有思路,所以只好通过查资料,与同学讨论,一起研究分析题目。虽然有两周时间,但每天只有两
11、个小时呆在机房,所以还得利用课后的时间继续加工。题目对于我来说比较难,自己编的代码运行不断地出错,经过修改N次后有的也能出现正确的结果,有点成就感。 在这期间,我们也查找了不少资料,发现很多知识是我们从没有接触过的,我们并不了解,所以借此增长了自己的见识,了解了更多关于它的应用。在编写程序代码时,需要什么函数,需要什么模块得一步一步的来,慢慢地研究,每天积累点,不能急于求成,有问题就应该去查资料,讨论,如果想要把所有东西都学到,那是比登天还难。 总之,通过这次的课程设计,体验到了真正的难度,不过也让我收获不少,虽然过程很艰辛,但自己坚持不懈,最后还是会得到自己想要的答案。从这次课程设计中也可以
12、看出自己的理论知识不牢固,所以得加强理论知识的学习,才能更好地理论联系实践。4参考文献:1MATLAB与控制系统仿真实践(第2版)2MathWorks,MATLAB R2007a,2007。3黄文梅,杨勇,熊桂林,系统分析与仿真-MATLAB语言及应用,长沙,国防科技大学出版社,1999 4尤昌德,现代控制理论基础,北京,电子工业出版社,1996 5 美Katsuhiko Ogata著,卢伯英,于海勋等译6现代控制工程(第三版),北京,电子工业出版社,20007黄涵洲,李志恒,现代控制理论引论,北京,北京工业大学出版社,1995 8钟
13、秀玲,控制系统数字仿真,北京,冶金工业出版社,19945附录:(计算器程序)function varargout = untitled(varargin)%UNTITLED M-file for untitled.fig% UNTITLED, by itself, creates a new UNTITLED or raises the existing% singleton*.% H = UNTITLED returns the handle to a new UNTITLED or the handle to% the existing singleton*.% UNTITLED('
14、;Property','Value',.) creates a new UNTITLED using the% given property value pairs. Unrecognized properties are passed via% varargin to untitled_OpeningFcn. This calling syntax produces a% warning when there is an existing singleton*.% UNTITLED('CALLBACK') and UNTITLED('CALLB
15、ACK',hObject,.) call the% local function named CALLBACK in UNTITLED.M with the given input% arguments.% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one% instance to run (singleton)".% See also: GUIDE, GUIDATA, GUIHANDLES % Edit the above text to modify the respo
16、nse to help untitled % Last Modified by GUIDE v2.5 19-Oct-2014 21:22:41 % Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct('gui_Name', mfilename, . 'gui_Singleton', gui_Singleton, . 'gui_OpeningFcn', untitled_OpeningFcn, . 'gui_OutputFcn', u
17、ntitled_OutputFcn, . 'gui_LayoutFcn', , . 'gui_Callback', );if nargin && ischar(varargin1) gui_State.gui_Callback = str2func(varargin1);end if nargout varargout1:nargout = gui_mainfcn(gui_State, varargin:);else gui_mainfcn(gui_State, varargin:);end% End initialization code -
18、DO NOT EDIT % - Executes just before untitled is made visible.function untitled_OpeningFcn(hObject, eventdata, handles, varargin)% This function has no output args, see OutputFcn.% hObject handle to figure% eventdata reserved - to be defined in a future version of MATLAB% handles structure with hand
19、les and user data (see GUIDATA)% varargin unrecognized PropertyName/PropertyValue pairs from the% command line (see VARARGIN) % Choose default command line output for untitledhandles.output = hObject; % Update handles structureguidata(hObject, handles); % UIWAIT makes untitled wait for user response
20、 (see UIRESUME)% uiwait(handles.figure1); % - Outputs from this function are returned to the command line.function varargout = untitled_OutputFcn(hObject, eventdata, handles)% varargout cell array for returning output args (see VARARGOUT);% hObject handle to figure% eventdata reserved - to be define
21、d in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % Get default command line output from handles structurevarargout1 = handles.output;%_¡ì¡ì_¡ì_¡ì_¨¨_¡ìset(handles.text1,'String','0.'
22、;); jj=0; shift=0; function text1_Callback(hObject, eventdata, handles)% hObject handle to text1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of text1 a
23、s text% str2double(get(hObject,'String') returns contents of text1 as a double % - Executes during object creation, after setting all properties.function text1_CreateFcn(hObject, eventdata, handles)% hObject handle to text1 (see GCBO)% eventdata reserved - to be defined in a future version o
24、f MATLAB% handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontr
25、olBackgroundColor');end % - Executes on button press in pushbutton1.function pushbutton1_Callback(hObject, eventdata, handles)global jjtextString = get(handles.text1,'String'); if(strcmp(textString,'0.')=1)&(jj=0) set(handles.text1,'String','1') else textStrin
26、g =strcat(textString,'1'); set(handles.text1,'String',textString) end jj=0; % hObject handle to pushbutton1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % - Executes on button press in pushbut
27、ton2.function pushbutton2_Callback(hObject, eventdata, handles) global jj textString = get(handles.text1,'String'); if(strcmp(textString,'0.')=1)&(jj=0) set(handles.text1,'String','2') else textString =strcat(textString,'2'); set(handles.text1,'String&
28、#39;,textString) end jj=0;% hObject handle to pushbutton2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % - Executes on button press in pushbutton3.function pushbutton3_Callback(hObject, eventdata, handles)glo
29、bal jj textString = get(handles.text1,'String'); if(strcmp(textString,'0.')=1)&(jj=0)set(handles.text1,'String','3') else textString =strcat(textString,'3'); set(handles.text1,'String',textString) end jj=0;% hObject handle to pushbutton3 (see GCBO)
30、% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % - Executes on button press in pushbutton4.function pushbutton4_Callback(hObject, eventdata, handles)global jj textString = get(handles.text1,'String'); if(strcmp(t
31、extString,'0.')=1)&(jj=0) set(handles.text1,'String','4') else textString =strcat(textString,'4'); set(handles.text1,'String',textString) end jj=0;% hObject handle to pushbutton4 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB%
32、 handles structure with handles and user data (see GUIDATA) % - Executes on button press in pushbutton5.function pushbutton5_Callback(hObject, eventdata, handles)global jj textString = get(handles.text1,'String');if(strcmp(textString,'0.')=1)&(jj=0)set(handles.text1,'String
33、39;,'5') else textString =strcat(textString,'5'); set(handles.text1,'String',textString) end jj=0;% hObject handle to pushbutton5 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % - Execu
34、tes on button press in pushbutton6.function pushbutton6_Callback(hObject, eventdata, handles)global jj textString = get(handles.text1,'String'); if(strcmp(textString,'0.')=1)&(jj=0) set(handles.text1,'String','6') else textString =strcat(textString,'6'); s
35、et(handles.text1,'String',textString) end jj=0;% hObject handle to pushbutton6 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % - Executes on button press in pushbutton7.function pushbutton7_Callback(hO
36、bject, eventdata, handles)global jj textString = get(handles.text1,'String'); if(strcmp(textString,'0.')=1)&(jj=0)set(handles.text1,'String','7') else textString =strcat(textString,'7'); set(handles.text1,'String',textString) end jj=0; % hObject ha
37、ndle to pushbutton7 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % - Executes on button press in pushbutton8.function pushbutton8_Callback(hObject, eventdata, handles)global jj textString = get(handles.text1,
38、'String'); if(strcmp(textString,'0.')=1)&(jj=0) set(handles.text1,'String','8') else textString =strcat(textString,'8'); set(handles.text1,'String',textString) end jj=0;% hObject handle to pushbutton8 (see GCBO)% eventdata reserved - to be defined
39、in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % - Executes on button press in pushbutton9.function pushbutton9_Callback(hObject, eventdata, handles)global jj textString = get(handles.text1,'String');if(strcmp(textString,'0.')=1)&(jj=0)
40、set(handles.text1,'String','9') else textString =strcat(textString,'9'); set(handles.text1,'String',textString) end jj=0;% hObject handle to pushbutton9 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and us
41、er data (see GUIDATA) % - Executes on button press in pushbutton10.function pushbutton10_Callback(hObject, eventdata, handles)global jj textString = get(handles.text1,'String'); if(strcmp(textString,'0.')=1)&(jj=0) set(handles.text1,'String','0.') else textString
42、=strcat(textString,'0'); set(handles.text1,'String',textString) end jj=0; % hObject handle to pushbutton10 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % - Executes on button press in pushbutt
43、on11.function pushbutton11_Callback(hObject, eventdata, handles)set(handles.text1,'String','0.')% hObject handle to pushbutton11 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % - Executes on bu
44、tton press in pushbutton12.function pushbutton12_Callback(hObject, eventdata, handles)global jj textString = get(handles.text1,'String'); if(strcmp(textString,'0.')=1)&(jj=0) set(handles.text1,'String','0.') else ss=char(textString); l=length(textString); textStri
45、ng=ss(1:l-1); set(handles.text1,'String',textString) end jj=0;% - Executes on button press in pushbutton28. function pushbutton28_Callback(hObject, eventdata, handles) textString = get(handles.text1,'String'); %strcmp(textString,'0.') if(strcmp(textString,'0.')=1) set
46、(handles.text1,'String','0.') else a = strread(textString, '%f'); a=1/a; set(handles.text1,'String',a) end% hObject handle to pushbutton12 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see G
47、UIDATA) % - Executes on button press in pushbutton13.function pushbutton13_Callback(hObject, eventdata, handles) textString = get(handles.text1,'String'); textString =strcat(textString,'+'); set(handles.text1,'String',textString)% hObject handle to pushbutton13 (see GCBO)% ev
48、entdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % - Executes on button press in pushbutton14.function pushbutton14_Callback(hObject, eventdata, handles)textString = get(handles.text1,'String'); textString =strcat(textString,'-');set(handles.text1,'String',textString)% hObject handle to pushbutton14 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) % -
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 《皓海量化投资》课件
- 《历史地理生物》课件
- 教育信息化培训计划革新:2024年视角下的战略规划
- 头部内伤护理方案
- 《情绪管理技巧培训》课件
- 《我爱学校主题班会》课件
- 电子记分牌 课程设计
- 《卵母细胞成熟》课件
- 石油套管购销合同(2篇)
- 铝合金加工厂合同
- 救援无人机应用
- (正式版)HGT 4148-2024 工业用三正丙胺
- 2024年中化集团中国对外经济贸易信托有限公司招聘笔试参考题库含答案解析
- 2024-2030年中国腐乳行业市场全景评估及发展趋势预测报告
- 新人教版八年级物理上册第四五章测试题
- (高清版)DZT 0073-2016 电阻率剖面法技术规程
- 《科普知识-火星》高清课件
- 《大自然的色彩》课件
- 环卫保洁日常巡检方案
- 2024届八省八校T8联考高三第二次学业质量评价 英语试题
- 中考英语一模作文-征集“文化自信类”写作
评论
0/150
提交评论