怎么求输入输出的函数

求大神帮助怎么求出输入输出的函数推倒过程... 求大神帮助 怎么求出输入输出的函数推倒过程 展开
 我来答
DoramiHe
2018-11-12 · 知道合伙人互联网行家
DoramiHe
知道合伙人互联网行家
采纳数:25332 获赞数:59543
2011年中山职业技术学院毕业,现担任毅衣公司京东小二

向TA提问 私信TA
展开全部

1/问题模型:已知一信号通过一黑匣子后输出另一信号,待求经过该黑匣子的一输入信号对应的输出信号;

2/分析:问题重点在于求解该模型传递函数,根据传递的定义,我们可以分别求出输入与输出信号的FFT变换,然后相除,在matlab中,直接按此法求解还是教复杂的。

具体求解实例过程如下图示:

来源:盛谦等,传递函数在地下工程地震响应中的应用

3/具体:先又输入与输出数据经系统辨识得出传递函数,然后将输入信号FFT变换成傅里叶谱,与传涵的实部、虚部相乘,得到频域估算结果,经IFFT变换得到时域估算结果。

在matlab中通过tfe可以对传函进行估算,绘出传递函数的幅频图与相频图。

4/下面是一个简单的实例:

下图分别为任意取定的一输入与输出信号



经系统辨识后绘出的幅频与相频如下:




找不到关键句了,把m文件粘上来,里面有些GUI的控制句,删掉就可以了

function varargout = CDHS(varargin)
% CDHS MATLAB code for CDHS.fig
%      CDHS, by itself, creates a new CDHS or raises the existing
%      singleton*.
%
%      H = CDHS returns the handle to a new CDHS or the handle to
%      the existing singleton*.
%
%      CDHS('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in CDHS.M with the given input arguments.
%
%      CDHS('Property','Value',...) creates a new CDHS or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before CDHS_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to CDHS_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

% Edit the above text to modify the response to help CDHS

% Last Modified by GUIDE v2.5 03-Dec-2013 10:11:36

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
'gui_Singleton',  gui_Singleton, ...
'gui_OpeningFcn', @CDHS_OpeningFcn, ...
'gui_OutputFcn',  @CDHS_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 CDHS is made visible.
function CDHS_OpeningFcn(hObject, eventdata, handles, varargin)
global s1 s2  hest1 f fs k4 k5 a real1 imag1 angle1;
% 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 CDHS (see VARARGIN)

% Choose default command line output for CDHS
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

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


% --- Outputs from this function are returned to the command line.
function varargout = CDHS_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;


% --- 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)
[filename,pathname]=uigetfile('*.xls','input the signal');
global s1 s2  hest1 f fs k4 k5 a real1 imag1 angle1;
file=[filename,pathname];
singal=xlsread(filename);
s1=singal(:,2);
k1=singal(2,1);
k2=singal(3,1);
k3=k2-k1;
fs=1/k3;
k4=length(s1);
k5=2*(k4-1);

% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% 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)
global s1 s2  hest1 f fs k4 k5 a real1 imag1 angle1;
[filename2,pathname2]=uigetfile('*.xls','input the signal');
file2=[filename2,pathname2];
sigal2=xlsread(filename2);
s2=sigal2(:,2);

% --- Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global s1 s2  hest1 f fs k4 k5 a real1 imag1 angle1;
[hest1,f]=tfe(s1,s2,k5,fs,k4,0,'mean');
real1=real(hest1);
imag1=imag(hest1);

% --- Executes on button press in pushbutton4.
function pushbutton4_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global s1 s2  hest1 f fs k4 k5 a real1 imag1 angle1;
a=abs(hest1);%求传涵幅值
plot(f,a);xlabel('Frequency');ylabel('H(w)');title('幅频图');%绘制传涵幅频图

% --- Executes on button press in pushbutton5.
function pushbutton5_Callback(hObject, eventdata, handles)
% 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)
global s1 s2  hest1 f fs k4 k5 a real1 imag1 angle1;
angle1=angle(hest1);
angle1=angle1/3.14159*180;%求相角
plot(f,angle1);xlabel('Frequency');ylabel('w');title('相频图');%绘制传涵相频图

% --- Executes on button press in pushbutton6.
function pushbutton6_Callback(hObject, eventdata, handles)
% 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)
global s1 s2  hest1 f fs k4 k5 a real1 imag1 angle1;
c=ones(s1,6);
ones(:,1)=f;
ones(:,2)=hest1;
ones(:,3)=real1;
ones(:,4)=imag1;
ones(:,5)=a;
ones(:,6)=angle1;
c1=ones';
outsignal=xlswrite('outcdhs.xls',c1);

% --- Executes on button press in pushbutton7.
function pushbutton7_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton7 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
close(handles.figure1)

推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式