matlab打开界面模糊,如何在人机界面GUI的M文件中嵌入模糊FIS模块
本帖最后由 martintsai 于 2011-4-12 11:05 編輯
我在進行汽車懸架系統(tǒng)的Simulink仿真畢業(yè)設(shè)計。
我之前已經(jīng)完成mdl的設(shè)計,并建立模糊模塊,mohu.fis,export to workspace后在mdl環(huán)境下可以運行,結(jié)果也比較滿意。
但是老師要求設(shè)計GUI,我設(shè)計完fig界面之后,進行GUI運行時,發(fā)現(xiàn)老是出現(xiàn)以下錯誤,
部分M文件程序如下,mass1,mass2,damping_coefficient,stiffness_coefficient四個函數(shù)讀取了FIG界面的數(shù)據(jù),出錯的位置好像在pushbutton2里面的sim
function mass1_Callback(hObject, eventdata, handles)
function mass1_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function mass2_Callback(hObject, eventdata, handles)
function mass2_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function damping_coefficient_Callback(hObject, eventdata, handles)
function damping_coefficient_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function stiffness_coefficient_Callback(hObject, eventdata, handles)
function stiffness_coefficient_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function pushbutton2_Callback(hObject, eventdata, handles)
axes(handles.axes1)
m1=str2num(get(handles.mass1,'String'));
m2=str2num(get(handles.mass2,'String'));
c=str2num(get(handles.damping_coefficient,'String'));
k1=str2num(get(handles.stiffness_coefficient,'String'));
options = simset('SrcWorkspace','current');
sim('suspensionsimulation',[],options);
plot(tout,yout)
axis([0 50 -1 1])
set(gca,'XTick',[0 25 50])
set(gca,'YTick',[-1 -0.5 0 0.5 1])
grid on
錯誤如下:
??? Error using ==> sim
Error in 'suspensionsimulation/fuzzy/Fuzzy Logic??Controller': Parameter 'mohu' cannot be evaluated.??MATLAB error message: Error using ==> sim
Undefined function or variable 'mohu'.
Error in ==> suspension_stimulation_GUI>pushbutton2_Callback at 167
sim('suspensionsimulation',[],options);
Error in ==> gui_mainfcn at 95
feval(varargin{:});
Error in ==> suspension_stimulation_GUI at 42
gui_mainfcn(gui_State, varargin{:});
??? Error using ==> suspension_stimulation_GUI('pushbutton2_Callback',gcbo,[],guidata(gcbo))
Error using ==> sim
Error in 'suspensionsimulation/fuzzy/Fuzzy Logic??Controller': Parameter 'mohu' cannot be evaluated.??MATLAB error message: Error using ==> sim
Undefined function or variable 'mohu'.
??? Error while evaluating uicontrol Callback
請高手指點啊,感激涕零啊??!!
2011-4-12 10:54 上傳
點擊文件名下載附件
下載積分: 貝殼 -1
24.63 KB, 下載次數(shù): 5, 下載積分: 貝殼 -1
總結(jié)
以上是生活随笔為你收集整理的matlab打开界面模糊,如何在人机界面GUI的M文件中嵌入模糊FIS模块的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: JAVA输出希腊union,希腊文化认为
- 下一篇: 文件夹修改名字 matlab,matla