马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?我要加入
x
=zpk(z,p,k)所生成式子中
z,p,k三个量是用户给定的,
那么它生成的式子就是不能
确定是哪个具体式子,所以如何
正确的将其显示在axes中.就是说
怎样将生成的zpk式子输出(在GUI中)
我的程序如下:
function varargout = cdhsbdszpk(varargin)
% CDHSBDSZPK M-file for cdhsbdszpk.fig
% CDHSBDSZPK, by itself, creates a new CDHSBDSZPK or raises the existing
% singleton*.
%
% H = CDHSBDSZPK returns the handle to a new CDHSBDSZPK or the handle to
% the existing singleton*.
%
% CDHSBDSZPK('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in CDHSBDSZPK.M with the given input arguments.
%
% CDHSBDSZPK('Property','Value',...) creates a new CDHSBDSZPK or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before cdhsbdszpk_OpeningFunction gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to cdhsbdszpk_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 cdhsbdszpk
% Last Modified by GUIDE v2.5 10-Feb-2008 10:10:49
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @cdhsbdszpk_OpeningFcn, ...
'gui_OutputFcn', @cdhsbdszpk_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 cdhsbdszpk is made visible.
function cdhsbdszpk_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 cdhsbdszpk (see VARARGIN)
% Choose default command line output for cdhsbdszpk
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes cdhsbdszpk wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = cdhsbdszpk_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
function edit_k_Callback(hObject, eventdata, handles)
% hObject handle to edit_k (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 edit_k as text
% str2double(get(hObject,'String')) returns contents of edit_k as a double
% --- Executes during object creation, after setting all properties.
function edit_k_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit_k (see GCBO)
% eventdata reserved - to be defined in a future version of 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,'defaultUicontrolBackgroundColor'));
end
function edit_z_Callback(hObject, eventdata, handles)
% hObject handle to edit_z (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 edit_z as text
% str2double(get(hObject,'String')) returns contents of edit_z as a double
% --- Executes during object creation, after setting all properties.
function edit_z_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit_z (see GCBO)
% eventdata reserved - to be defined in a future version of 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,'defaultUicontrolBackgroundColor'));
end
function edit_p_Callback(hObject, eventdata, handles)
% hObject handle to edit_p (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 edit_p as text
% str2double(get(hObject,'String')) returns contents of edit_p as a double
% --- Executes during object creation, after setting all properties.
function edit_p_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit_p (see GCBO)
% eventdata reserved - to be defined in a future version of 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,'defaultUicontrolBackgroundColor'));
end
function edit_fz_Callback(hObject, eventdata, handles)
% hObject handle to edit_fz (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 edit_fz as text
% str2double(get(hObject,'String')) returns contents of edit_fz as a double
% --- Executes during object creation, after setting all properties.
function edit_fz_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit_fz (see GCBO)
% eventdata reserved - to be defined in a future version of 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,'defaultUicontrolBackgroundColor'));
end
function edit_fm_Callback(hObject, eventdata, handles)
% hObject handle to edit_fm (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 edit_fm as text
% str2double(get(hObject,'String')) returns contents of edit_fm as a double
% --- Executes during object creation, after setting all properties.
function edit_fm_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit_fm (see GCBO)
% eventdata reserved - to be defined in a future version of 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,'defaultUicontrolBackgroundColor'));
end
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% 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)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
K=str2num(get(handles.edit_k,'String'));
Z=str2num(get(handles.edit_z,'String'));
P=str2num(get(handles.edit_p,'String'));
g=zpk(Z,P,K)
[fz,fm,pp]=zpkdata(g)
cla
axes(handles.axes1);
h1 = text('Interpreter','latex',...
'String','$$\frac{fz}{fm}{pp}$$',...
'Position',[0 0.5],...
'FontSize',16);
到了这步就弄不下去了.显示的不是我想要的~~~:(
用哪个参数可以将zpk 生成的式子转换成字符串.
[ 本帖最后由 eight 于 2008-2-14 09:47 编辑 ] |