yyc0424 发表于 2007-5-7 11:05

[求助]学过自动控制的请进,想做一个关于控制的gui

<P>请教各位:用gui画图怎么不能用控制里的一些画图的命令啊?我试过了画一些数学函数的图像可以,比如用plot,stem等,但是画step,nyquist都不行,有没有人能帮忙解答?<BR>.m文件如下:<BR>function varargout = my02(varargin)<BR>% MY02 M-file for my02.fig<BR>%      MY02, by itself, creates a new MY02 or raises the existing<BR>%      singleton*.<BR>%<BR>%      H = MY02 returns the handle to a new MY02 or the handle to<BR>%      the existing singleton*.<BR>%<BR>%      MY02('CALLBACK',hObject,eventData,handles,...) calls the local<BR>%      function named CALLBACK in MY02.M with the given input arguments.<BR>%<BR>%      MY02('Property','Value',...) creates a new MY02 or raises the<BR>%      existing singleton*.  Starting from the left, property value pairs are<BR>%      applied to the GUI before my02_OpeningFunction gets called.  An<BR>%      unrecognized property name or invalid value makes property application<BR>%      stop.  All inputs are passed to my02_OpeningFcn via varargin.<BR>%<BR>%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one<BR>%      instance to run (singleton)".<BR>%<BR>% See also: GUIDE, GUIDATA, GUIHANDLES</P>
<P>% Edit the above text to modify the response to help my02</P>
<P>% Last Modified by GUIDE v2.5 07-May-2007 09:57:04</P>
<P>% Begin initialization code - DO NOT EDIT<BR>gui_Singleton = 1;<BR>gui_State = struct('gui_Name',       mfilename, ...<BR>                   'gui_Singleton',  gui_Singleton, ...<BR>                   'gui_OpeningFcn', @my02_OpeningFcn, ...<BR>                   'gui_OutputFcn',  @my02_OutputFcn, ...<BR>                   'gui_LayoutFcn',  [] , ...<BR>                   'gui_Callback',   []);<BR>if nargin &amp; isstr(varargin{1})<BR>    gui_State.gui_Callback = str2func(varargin{1});<BR>end</P>
<P>if nargout<BR>    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});<BR>else<BR>    gui_mainfcn(gui_State, varargin{:});<BR>end<BR>% End initialization code - DO NOT EDIT</P>
<P><BR>% --- Executes just before my02 is made visible.<BR>function my02_OpeningFcn(hObject, eventdata, handles, varargin)<BR>% This function has no output args, see OutputFcn.<BR>% hObject    handle to figure<BR>% eventdata  reserved - to be defined in a future version of MATLAB<BR>% handles    structure with handles and user data (see GUIDATA)<BR>% varargin   command line arguments to my02 (see VARARGIN)</P>
<P>% Choose default command line output for my02<BR>handles.output = hObject;</P>
<P>% Update handles structure<BR>guidata(hObject, handles);</P>
<P>% UIWAIT makes my02 wait for user response (see UIRESUME)<BR>% uiwait(handles.figure1);</P>
<P><BR>% --- Outputs from this function are returned to the command line.<BR>function varargout = my02_OutputFcn(hObject, eventdata, handles)<BR>% varargout  cell array for returning output args (see VARARGOUT);<BR>% hObject    handle to figure<BR>% eventdata  reserved - to be defined in a future version of MATLAB<BR>% handles    structure with handles and user data (see GUIDATA)</P>
<P>% Get default command line output from handles structure<BR>varargout{1} = handles.output;</P>
<P><BR>% --- Executes on button press in pushbutton1.<BR>function pushbutton1_Callback(hObject, eventdata, handles)<BR>% hObject    handle to pushbutton1 (see GCBO)<BR>% eventdata  reserved - to be defined in a future version of MATLAB<BR>% handles    structure with handles and user data (see GUIDATA)<BR>den=[0 0 80];<BR>num=[1 2 0];<BR>sys=tf(num,den);<BR>rlocus(sys);<BR>% --- Executes on button press in pushbutton2.<BR>function pushbutton2_Callback(hObject, eventdata, handles)<BR>% hObject    handle to pushbutton2 (see GCBO)<BR>% eventdata  reserved - to be defined in a future version of MATLAB<BR>% handles    structure with handles and user data (see GUIDATA)<BR>grid</P>

yyc0424 发表于 2007-5-8 10:07

<P>已经解答了,好像是自己电脑装的MATLAB有问题,在学校实验室的机子上运行得出来[em01]</P>

撒有拉拉 发表于 2008-6-4 15:51

想请教哈你

我们老师让做,两个文本框,一个坐标。一个文本框可以显示主程序,另一个可以改变其中的参数。例如比例环节中的R2/R1.但是修改参数后不管用.
    想请问你,怎么弄.
    我的QQ:407912469

页: [1]

编程论坛