时域和频域是信号的基本性质,这样可以用多种方式来分析信号,每种方式提供了不同的角度。解决问题的最快方式不一定是最明显的方式,用来分析信号的不同角度称为域。时域频域可清楚反应信号与互连线之间的相互影响。
1 时域
时域是真实世界,是惟一实际存在的域。因为我们的经历都是在时域中发展和验证的,已经习惯于事件按时间的先后顺序地发生。而评估数字产品的性能时,通常在时域中进行分析,因为产品的性能最终就是在时域中测量的。
时钟波形的两个重要参数是时钟周期和上升时间。
图中标明了1GHz时钟信号的时钟周期和10-90上升时间。下降时间一般要比上升时间短一些,有时会出现更多的噪声。
时钟周期就是时钟循环重复一次的时间间隔,通常用ns度量。时钟频率Fclock,即1秒钟内时钟循环的次数,是时钟周期Tclock的倒数。
Fclock=1/Tclock
上升时间与信号从低电平跳变到高电平所经历的时间有关,通常有两种定义。一种是10-90上升时间,指信号从终值的10%跳变到90%所经历的时间。这通常是一种默认的表达方式,可以从波形的时域图上直接读出。第二种定义方式是20-80上升时间,这是指从终值的20%跳变到80%所经历的时间。
时域波形的下降时间也有一个相应的值。根据逻辑系列可知,下降时间通常要比上升时间短一些,这是由典型CMOS输出驱动器的设计造成的。在典型的输出驱动器中,p管和n管在电源轨道Vcc和Vss间是串联的,输出连在这个两个管子的中间。在任一时间,只有一个晶体管导通,至于是哪一个管子导通取决于输出的高或低状态。
2 频域
频域,尤其在射频和通信系统中运用较多,在高速数字应用中也会遇到频域。频域最重要的性质是:它不是真实的,而是一个数学构造。时域是惟一客观存在的域,而频域是一个遵循特定规则的数学范畴,频域也被一些学者称为上帝视角。
正弦波是频域中唯一存在的波形,这是频域中最重要的规则,即正弦波是对频域的描述,因为频域中的任何波形都可用正弦波合成。这是正弦波的一个非常重要的性质。然而,它并不是正弦波的独有特性,还有许多其他的波形也有这样的性质。正弦波有四个性质使它可以有效地描述其他任一波形:
(1)频域中的任何波形都可以由正弦波的组合完全且惟一地描述。
(2)任何两个频率不同的正弦波都是正交的。如果将两个正弦波相乘并在整个时间轴上求积分,则积分值为零。这说明可以将不同的频率分量相互分离开。
(3)正弦波有精确的数学定义。
(4)正弦波及其微分值处处存在,没有上下边界。
使用正弦波作为频域中的函数形式有它特别的地方。若使用正弦波,则与互连线的电气效应相关的一些问题将变得更容易理解和解决。如果变换到频域并使用正弦波描述,有时会比仅仅在时域中能更快地得到答案。
而在实际中,首先建立包含电阻,电感和电容的电路,并输入任意波形。一般情况下,就会得到一个类似正弦波的波形。而且,用几个正弦波的组合就能很容易地描述这些波形,如下图2.2所示:
图2.2 理想RLC电路相互作用的时域行为
3 时域频域的关系
时域分析与频域分析是对模拟信号的两个观察面。时域分析是以时间轴为坐标表示动态信号的关系;频域分析是把信号变为以频率轴为坐标表示出来。一般来说,时域的表示较为形象与直观,频域分析则更为简练,剖析问题更为深刻和方便。信号分析的趋势是从时域向频域发展。然而,它们是互相联系,缺一不可,相辅相成的。
4 时域和频域的转换
动态信号从时间域变换到频率域主要通过傅立叶级数和傅立叶变换实现。周期信号靠傅立叶级数,非周期信号靠傅立叶变换。时域越宽,频域越短。
s(f) = ∫-∞ +∞ (s(t)·e)dt
sD(t)= dS(t)/dt
sD(f)= ∫-∞ (sD(t)·e-j2∏ft)dt=j·2∏f· s(f)
function varargout = gui(varargin)
% GUI MATLAB code for gui.fig
% GUI, by itself, creates a new GUI or raises the existing
% singleton*.
%
% H = GUI returns the handle to a new GUI or the handle to
% the existing singleton*.
%
% GUI('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in GUI.M with the given input arguments.
%
% GUI('Property','Value',...) creates a new GUI or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before gui_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to gui_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 gui
% Last Modified by GUIDE v2.5 23-Apr-2019 15:32:28
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @gui_OpeningFcn, ...
'gui_OutputFcn', @gui_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 gui is made visible.
function gui_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 gui (see VARARGIN)
% Choose default command line output for gui
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes gui wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = gui_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)
global aud RecordLength ShowLength FrequencyWindow1 FrequencyWindow2 fs nBits
global mag idx_last recObj myRecording bit
record(recObj,RecordLength);
tic
while toc<.1
end
bit = 2;
while toc<RecordLength
myRecording = getaudiodata(recObj);
idx = round(toc*fs);
while idx-idx_last<.1*fs
idx=round(toc*fs);
end
axes(handles.axes1)
plot((max(1,size(myRecording,1)-fs*ShowLength):(2^bit):size(myRecording,1))./fs,myRecording(max(1,size(myRecording,1)-fs*ShowLength):(2^bit):end))
mag = max(abs(myRecording));
ylim([-1.2 1.2]*mag)
xlim([max(0,size(myRecording,1)/fs-ShowLength)
max(size(myRecording,1)/fs,ShowLength)])
title('声音信号的波形显示');
ylabel('Signal level(volts)');
xlabel('Samples');
drawnow
idx_last = idx;
end
% --- 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 aud RecordLength ShowLength FrequencyWindow1 FrequencyWindow2 fs nBits
global mag idx_last recObj myRecording
save data.mat aud RecordLength ShowLength FrequencyWindow1 FrequencyWindow2 fs nBits mag idx_last recObj myRecording
% --- 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)
% --- 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)
clc,clear,
close all force;
% --- 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 aud RecordLength ShowLength FrequencyWindow1 FrequencyWindow2 fs nBits
global mag idx_last recObj
aud = audiodevinfo;
RecordLength = 15;
ShowLength = 15;
FrequencyWindow1 = 0;
FrequencyWindow2 = 3000;
fs = 44100;
nBits = 16;
mag = 1.05;
idx_last = 1;
recObj = audiorecorder(fs,nBits,1);
if isempty(recObj);
else
msgbox('语音设备已检测到!!!');
end
% --- 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)
% --- 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)
global fs
load('data.mat')
sound(myRecording,fs);
% --------------------------------------------------------------------
function Untitled_1_Callback(hObject, eventdata, handles)
% hObject handle to Untitled_1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global aud RecordLength ShowLength FrequencyWindow1 FrequencyWindow2 fs nBits
global mag idx_last recObj myRecording bit x3
x1 = myRecording(max(1,size(myRecording,1)-fs*ShowLength):(2^bit):end);
N=length(x1);
x2 = x1-mean(x1);
x3 = smooth(x2);
axes(handles.axes1)
plot(x3,'b-','linewidth',2)
axis tight
title('零均值化——平滑滤波')
% --------------------------------------------------------------------
function Untitled_2_Callback(hObject, eventdata, handles)
% hObject handle to Untitled_2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
版本:2014a