logo资料库

matlab函数 产生三角波的函数.doc

第1页 / 共4页
第2页 / 共4页
第3页 / 共4页
第4页 / 共4页
资料共4页,全文预览结束
MATLAB中freqz函数的用法
Matlab 控制信号函数 sawtooth 的功能:产生锯齿波或三角波。 格式:x = sawtooth(t) x = sawtooth(t,width) t 为 0.5 为三角波,1 为据此波 说明:sawtooth(t)类似于 sin(t),产生周期为 2π,幅值从-1 到+1 的锯齿波。在 2π的 整数倍处,值为-1,从-1 到+1 这一段波形的斜率为 1/π。 sawtooth(t,width)产生三角波。 举例:产生周期为 0.02 的三角波,结果见图 1.1.3。 Fs = 10000; t = 0:1/Fs:1.5; x = sawtooth(2*pi*50*t); plot(t,x), axis([0 0.2 -1 1])
MATLAB 中 freqz 函数的用法 默认分类 2009-04-29 18:17:57 阅读 3020 评论 0 字号:大中小 FREQZ 是计算数字滤波器的频率响应的函数 [H,W] = FREQZ(B,A,N) returns the N-point complex frequency response vector H and the N-point frequency vector W in radians/sample of the filter: 函数的输出:a.滤波器的频率响应 H(N 点) b.频率向量 W(N 点,且单位为弧度) 其中,滤波器形式如下: given numerator and denominator coefficients in vectors B and A. The frequency response is evaluated at N points equally spaced around the upper half of the unit circle. If N isn't specified, it defaults to 512. 滤波器的系数: 分子为 B,分母为 A 频率向量 W,是均匀分布在滤波器的上半区,即:0:pi,这些点上的频率响应都将通过此函数计算出来。 举例: 假设滤波器的系数 A=1,B=【1 1/2 1/3 1/4】;通过 FREQZ 函数便可以得到此滤波器的频率特性 其中,需要考察的是 H 和 W 的长度,看是否符合我们设置的 N。
[H,W] = FREQZ(B,A,N,'whole') uses N points around the whole unit circle. 函数给出了滤波器的双边频率特性,是 N 点的 H = FREQZ(B,A,W) returns the frequency response at frequencies designated in vector W, in radians/sample (normally between 0 and pi). 函数的输出依然是滤波器的频率响应 H,只不过这个 H 是限定了范围的,不再是全频率(0:pi)上的了,这个范围由 W 来指定,单位是弧度。 举例:W=【0.5pi----pi】,下图中,红线部分便是此函数的输出,可见,只描述了【0.5pi----pi】之间的频率响应。 [H,F] = FREQZ(B,A,N,Fs) and [H,F] = FREQZ(B,A,N,'whole',Fs) return frequency vector F (in Hz), where Fs is the sampling frequency (in Hz). 注意下图的横坐标与程序中 fs 的关系 H = FREQZ(B,A,F,Fs) returns the complex frequency response at the frequencies designated in vector F (in Hz), where Fs is the sampling frequency (in Hz). FREQZ(B,A,...) with no output arguments plots the magnitude and unwrapped phase of the filter in the current figure window.
MATLAB 中 unwrap 命令 要计算一个系统相频特性,就要用到反正切函数,计算机中反正切函数规定,在一、二象限中的角度为 0~pi,三四象限的角度为 0~-pi。 若一个角度从 0 变到 2pi,但实际得到的结果是 0~pi,再由-pi~0,在 w=pi 处发生跳变,跳变幅度为 2pi,这就叫相位的卷绕。 unwrap(w)就是解卷绕,使相位在 pi 处不发生跳变,从而反应出真实的相位变化。
分享到:
收藏