xxxx18一60岁hd中国/日韩女同互慰一区二区/西西人体扒开双腿无遮挡/日韩欧美黄色一级片 - 色护士精品影院www

  • 大小: 72KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發(fā)布日期: 2021-05-28
  • 語(yǔ)言: Matlab
  • 標(biāo)簽: matlab??

資源簡(jiǎn)介

原創(chuàng)畢業(yè)設(shè)計(jì)完工貼出來(lái)和大家分享一下吧-metro_simulation.rar
我的畢業(yè)設(shè)計(jì)是做一個(gè)地鐵列車運(yùn)行過(guò)程的仿真系統(tǒng)。當(dāng)然,不是很復(fù)雜。在simulink里面建立模型,然后用GUI對(duì)其中變量進(jìn)行賦值,并通過(guò)GUI中的一段函數(shù)對(duì)制動(dòng)點(diǎn)進(jìn)行試湊,最后顯示出列車的速度-路程曲線,行駛總路程和時(shí)間。
-------------------------------------------
現(xiàn)將GUI中所調(diào)用的功能及其實(shí)現(xiàn)方法整理如下:
1、點(diǎn)擊按鈕,切換GUI。這個(gè)現(xiàn)實(shí)起來(lái)很簡(jiǎn)單,只要在按扭的callback函數(shù)里寫(xiě)上run; close;即可。

2、把GUI中edit框中的數(shù)值賦給simulink中對(duì)應(yīng)的變量。這個(gè)問(wèn)題一開(kāi)始困擾了我好一段時(shí)間,看了很多例子都不行,有人說(shuō)用set_param,但我用了之后總是會(huì)報(bào)錯(cuò)說(shuō)變量沒(méi)有定義。其實(shí),只需要用等號(hào)對(duì)變量名進(jìn)行賦值即可。例如:simulink中某個(gè)變量為M,edit框的確Tag為name,那么相應(yīng)的代碼就是M=str2double);這里的str2double是將字符串轉(zhuǎn)變?yōu)閐ouble型的雙精度數(shù)。調(diào)用simulink前寫(xiě)上options = simset;再進(jìn)行調(diào)用sim;

3、從excel中讀取數(shù)據(jù),并將其賦給對(duì)應(yīng)的edit框。這個(gè)在math大哥的視頻里已經(jīng)有詳細(xì)解析了,這里就不綴述了。

4、將GUI中的參數(shù)保存進(jìn)excel文件中,這個(gè)與讀取過(guò)程類似,不過(guò)用的函數(shù)是uiputfile和xlswrite,具體的到matlab幫助里看一下就可以了,里面寫(xiě)得非常清楚。

5、將最后的仿真結(jié)果繪制出來(lái)。這個(gè)實(shí)現(xiàn)起來(lái)相對(duì)比較麻煩。首先在simulink里要添加"to workspace"模塊(注意save format一定要選擇Array)。然后在調(diào)用simulink仿真的語(yǔ)句后面,用assignin函數(shù)將"to workspace"輸出的數(shù)據(jù)保存在workspace中的向量中,例如assignin; result是輸出的結(jié)果,k1是保存的向量名。在調(diào)用k1進(jìn)行畫(huà)圖的時(shí)候,需要用evalin函數(shù)將k1從工作空間中讀取出來(lái),如k2=evalin。

如果輸出的結(jié)果是最終的一個(gè)數(shù),而非一個(gè)數(shù)組,則可以用result來(lái)獲取,這里的t是仿真時(shí)間長(zhǎng)度,step為仿真步長(zhǎng)。
----------------------
我用到的GUI主要部分就是這些,希望能對(duì)大家有些幫助。GUI入手的確比較困難,但只要多看幾個(gè)例子,問(wèn)題就會(huì)迎仞而解。ilovematlab論壇的確給我們提供了一個(gè)良好的平臺(tái),從這里學(xué)到了很多有用的東西。

----------------------------------
----------------------------------
附件中是我的源程序,運(yùn)行時(shí)先從preface開(kāi)始。
1.jpg
2.jpg
3.jpg
4.jpg

資源截圖

代碼片段和文件信息

function?varargout?=?graph(varargin)
%?GRAPH?M-file?for?graph.fig
%??????GRAPH?by?itself?creates?a?new?GRAPH?or?raises?the?existing
%??????singleton*.
%
%??????H?=?GRAPH?returns?the?handle?to?a?new?GRAPH?or?the?handle?to
%??????the?existing?singleton*.
%
%??????GRAPH(‘CALLBACK‘hobjecteventDatahandles...)?calls?the?local
%??????function?named?CALLBACK?in?GRAPH.M?with?the?given?input?arguments.
%
%??????GRAPH(‘Property‘‘Value‘...)?creates?a?new?GRAPH?or?raises?the
%??????existing?singleton*.??Starting?from?the?left?property?value?pairs?are
%??????applied?to?the?GUI?before?graph_OpeningFunction?gets?called.??An
%??????unrecognized?property?name?or?invalid?value?makes?property?application
%??????stop.??All?inputs?are?passed?to?graph_OpeningFcn?via?varargin.
%
%??????*See?GUI?Options?on?GUIDE‘s?Tools?menu.??Choose?“GUI?allows?only?one
%??????instance?to?run?(singleton)“.
%
%?See?also:?GUIDE?GUIDATA?GUIHANDLES

%?Copyright?2002-2003?The?MathWorks?Inc.

%?Edit?the?above?text?to?modify?the?response?to?help?graph

%?Last?Modified?by?GUIDE?v2.5?25-Mar-2002?12:19:15

%?Begin?initialization?code?-?DO?NOT?EDIT
gui_Singleton?=?1;
gui_State?=?struct(‘gui_Name‘???????mfilename?...
???????????????????‘gui_Singleton‘??gui_Singleton?...
???????????????????‘gui_OpeningFcn‘?@graph_OpeningFcn?...
???????????????????‘gui_OutputFcn‘??@graph_OutputFcn?...
???????????????????‘gui_LayoutFcn‘??[]??...
???????????????????‘gui_Callback‘???[]);
if?nargin?&&?ischar(varargin{1})
????gui_State.gui_Callback?=?str2func(varargin{1});
end

if?nargout
????[varargout{1:nargout}]?=?gui_mainfcn(gui_State?varargin{:});
else
????gui_mainfcn(gui_State?varargin{:});
end
%?End?initialization?code?-?DO?NOT?EDIT


%?---?Executes?just?before?graph?is?made?visible.
function?graph_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?handles?and?user?data?(see?GUIDATA)
%?varargin???command?line?arguments?to?graph?(see?VARARGIN)

%?Choose?default?command?line?output?for?graph
handles.output?=?hobject;
axes(handles.axes3);
distance=evalin(‘base‘‘k1‘);
velocity=evalin(‘base‘‘k2‘);
plot(distancevelocity);
xlabel(‘Distance?(m)‘);
ylabel(‘Velocity?(km/h)‘);
title(‘Figure?of?Velocity?against?Distance‘);
grid?on;
axes(handles.axes4);
t=evalin(‘base‘‘k3‘);
plot(tvelocity);
xlabel(‘Time?(s)‘);
ylabel(‘Velocity?(km/h)‘);
title(‘Figure?of?Velocity?against?Time‘);
grid?on;

%?Update?handles?structure
guidata(hobject?handles);

%?UIWAIT?makes?graph?wait?for?user?response?(see?UIRESUME)
%?uiwait(handles.figure1);


%?---?Outputs?from?this?function?are?returned?to?the?command?line.
function?varargout?=?graph_OutputFcn(hobject?eventdata?handles)?
%?varargout??cell?array?for?returning?output?args?(see?VARARGOUT);
%?hobject????hand

?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----

?????文件??????13824??2009-05-16?12:32??metro_simulation(Final)\ABC.xls

?????文件??????13824??2009-05-14?19:25??metro_simulation(Final)\file2.xls

?????文件??????36163??2009-05-16?19:27??metro_simulation(Final)\graph.fig

?????文件???????3240??2009-05-15?22:48??metro_simulation(Final)\graph.m

?????文件??????10142??2009-05-16?14:13??metro_simulation(Final)\main.fig

?????文件??????33033??2009-05-16?16:04??metro_simulation(Final)\main.m

?????文件?????127680??2009-05-16?19:35??metro_simulation(Final)\metro_simulation.mdl

?????文件??????14336??2009-05-14?18:52??metro_simulation(Final)\parameter.xls

?????文件???????2205??2009-05-18?12:38??metro_simulation(Final)\preface.fig

?????文件???????3207??2009-05-11?10:35??metro_simulation(Final)\preface.m

?????目錄??????????0??2009-05-18?12:37??metro_simulation(Final)

-----------?---------??----------?-----??----

???????????????257654????????????????????11


評(píng)論

共有 條評(píng)論