分享
分销 收藏 举报 申诉 / 24
播放页_导航下方通栏广告

类型实验用Matlab基本函数.doc

  • 上传人:仙人****88
  • 文档编号:11987522
  • 上传时间:2025-08-25
  • 格式:DOC
  • 页数:24
  • 大小:178.10KB
  • 下载积分:10 金币
  • 播放页_非在线预览资源立即下载上方广告
    配套讲稿:

    如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。

    特殊限制:

    部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。

    关 键  词:
    实验 Matlab 基本 函数
    资源描述:
    实验用Matlab基本函数 1.abs Absolute value (magnitude) Syntax y = abs(x) Description y = abs(x) returns the absolute value of the elements of x. If x is complex, abs returns the complex modulus (magnitude). abs(x) = sqrt(real(x).^2 + imag(x).^2) If x is a MATLAB string, abs returns the numeric values of the ASCII characters in the string. The display format of the string changes; the internal representation does not. The abs function is part of the standard MATLAB language. Example Calculate the magnitude of the FFT of a sequence. t = (0:99)/100; % time vector x = sin(2*pi*15*t) + sin(2*pi*40*t); % signal y = fft(x); % compute DFT of x m = abs(y); % magnitude Plot the magnitude. f = (0:length(y)-1)'/length(y)*100; % frequency vector plot(f,m) 2. angle Phase angle Syntax p = angle(h) Description p = angle(h) returns the phase angles, in radians, of the elements of complex vector or array h. The phase angles lie between - and . For complex sequence h = x + iy = meip, the magnitude and phase are given by m = abs(h) p = angle(h) To convert to the original h from its magnitude and phase, type i = sqrt(-1) h = m.*exp(i*p) The angle function is part of the standard MATLAB language. Example Calculate the phase of the FFT of a sequence. t = (0:99)/100; % time vector x = sin(2*pi*15*t) + sin(2*pi*40*t); % signal y = fft(x); % compute DFT of x p = unwrap(angle(y)); % phase Plot the phase. f = (0:length(y)-1)'/length(y)*100; % frequency vector plot(f,p) Algorithm angle can be expressed as angle(x) = imag(log(x)) = atan2(imag(x),real(x)) 3. besself Bessel analog filter design Syntax [b,a] = besself(n,Wn) [b,a] = besself(n,Wn,'ftype') [z,p,k] = besself(...) [A,B,C,D] = besself(...) Description besself designs lowpass, bandpass, highpass, and bandstop analog Bessel filters. Analog Bessel filters are characterized by almost constant group delay across the entire passband, thus preserving the wave shape of filtered signals in the passband. Digital Bessel filters do not retain this quality, and besself therefore does not support the design of digital Bessel filters. [b,a] = besself(n,Wn) designs an order n lowpass analog filter with cutoff frequency Wn. It returns the filter coefficients in the length n+1 row vectors b and a, with coefficients in descending powers of s, derived from the transfer function Cutoff frequency is the frequency at which the magnitude response of the filter begins to decrease significantly. For besself, the cutoff frequency Wn must be greater than 0. The magnitude response of a Bessel filter designed by besself is always less than at the cutoff frequency, and it decreases as the order n increases. If Wn is a two-element vector, Wn = [w1 w2] with w1 < w2, then besself(n,Wn) returns an order 2*n bandpass analog filter with passband w1 <ω< w2. [b,a] = besself(n,Wn,'ftype') designs a highpass or bandstop filter, where the string 'ftype' is: l 'high' for a highpass analog filter with cutoff frequency Wn l 'stop' for an order 2*n bandstop analog filter if Wn is a two-element vector, Wn = [w1 w2] The stopband is w1 <ω< w2. With different numbers of output arguments, besself directly obtains other realizations of the analog filter. To obtain zero-pole-gain form, use three output arguments as shown below. [z,p,k] = besself(n,Wn) or [z,p,k] = besself(n,Wn,'ftype') returns the zeros and poles in length n or 2*n column vectors z and p and the gain in the scalar k. Algorithm besself performs a four-step algorithm: l It finds lowpass analog prototype poles, zeros, and gain using the besselapfunction. l It converts the poles, zeros, and gain into state-space form. l It transforms the lowpass filter into a bandpass, highpass, or bandstop filterwith desired cutoff frequencies using a state-space transformation. l It converts the state-space filter back to transfer function or zero-pole-gain form, as required. 4. bilinear Bilinear transformation method for analog-to-digital filter conversion Syntax [zd,pd,kd] = bilinear(z,p,k,fs) [zd,pd,kd] = bilinear(z,p,k,fs,Fp) [numd,dend] = bilinear(num,den,fs) [numd,dend] = bilinear(num,den,fs,Fp) [Ad,Bd,Cd,Dd] = bilinear(A,B,C,D,fs) [Ad,Bd,Cd,Dd] = bilinear(A,B,C,D,fs,Fp) Description The bilinear transformation is a mathematical mapping of variables. In digital filtering, it is a standard method of mapping the s or analog plane into the z or digital plane. It transforms analog filters, designed using classical filter design techniques, into their discrete equivalents. Zero-Pole-Gain [zd,pd,kd] = bilinear(z,p,k,fs) and [zd,pd,kd] = bilinear(z,p,k,fs,Fp) convert the s-domain transfer function specified by z, p, and k to a discrete equivalent. Inputs z and p are column vectors containing the zeros and poles, k is a scalar gain, and fs is the sampling frequency in hertz. bilinear returns the discrete equivalent in column vectors zd and pd and scalar kd. Fp is the optional match frequency, in hertz, for prewarping. Transfer Function [numd,dend] = bilinear(num,den,fs) and [numd,dend] = bilinear(num,den,fs,Fp) convert an s-domain transfer function given by num and den to a discrete equivalent. Row vectors num and den specify the coefficients of the numerator and denominator, respectively, in descending powers of s. fs is the sampling frequency in hertz. bilinear returns the discrete equivalent in row vectors numd and dend in descending powers of z (ascending powers of z-1). Fp is the optional match frequency, in hertz, for prewarping. 5. butter Butterworth analog and digital filter design Syntax [b,a] = butter(n,Wn) [b,a] = butter(n,Wn,'ftype') [b,a] = butter(n,Wn,'s') [b,a] = butter(n,Wn,'ftype','s') [z,p,k] = butter(...) [A,B,C,D] = butter(...) Description butter designs lowpass, bandpass, highpass, and bandstop digital and analog Butterworth filters. Butterworth filters are characterized by a magnitude response that is maximally flat in the passband and monotonic overall. Butterworth filters sacrifice rolloff steepness for monotonicity in the pass- and stopbands. Unless the smoothness of the Butterworth filter is needed, an elliptic or Chebyshev filter can generally provide steeper rolloff characteristics with a lower filter order. Digital Domain [b,a] = butter(n,Wn) designs an order n lowpass digital Butterworth filter with cutoff frequency Wn. It returns the filter coefficients in length n+1 row vectors b and a, with coefficients in descending powers of z. Cutoff frequency is that frequency where the magnitude response of the filter is . For butter, the normalized cutoff frequency Wn must be a number between 0 and 1, where 1 corresponds to the Nyquist frequency, π radians per sample. If Wn is a two-element vector, Wn = [w1 w2], butter returns an order 2*n digital bandpass filter with passband w1 <ω< w2. [b,a] = butter(n,Wn,'ftype') designs a highpass or bandstop filter, where the string 'ftype' is either: l 'high' for a highpass digital filter with cutoff frequency Wn l 'stop' for an order 2*n bandstop digital filter if Wn is a two-element vector, Wn = [w1 w2]. The stopband is w1 <ω< w2. With different numbers of output arguments, butter directly obtains other realizations of the filter. To obtain zero-pole-gain form, use three output arguments as shown below. [z,p,k] = butter(n,Wn) or [z,p,k] = butter(n,Wn,'ftype') returns the zeros and poles in length n column vectors z and p, and the gain in the scalar k. Analog Domain [b,a] = butter(n,Wn,'s') designs an order n lowpass analog Butterworth filter with cutoff frequency Wn rad/s. It returns the filter coefficients in the length n+1 row vectors b and a, in descending powers of s, derived from the transfer function butter's cutoff frequency Wn must be greater than 0 rad/s. If Wn is a two-element vector with w1 < w2, butter(n,Wn,'s') returns an order 2*n bandpass analog filter with passband w1 <ω< w2. [b,a] = butter(n,Wn,'ftype','s') designs a highpass or bandstop filter. With different numbers of output arguments, butter directly obtains other realizations of the analog filter. To obtain zero-pole-gain form, use three output arguments as shown below. [z,p,k] = butter(n,Wn,'s') or [z,p,k] = butter(n,Wn,'ftype','s') returns the zeros and poles in length n or 2*n column vectors z and p and the gain in the scalar k. Examples Example 1 For data sampled at 1000 Hz, design a 9th-order highpass Butterworth filter with cutoff frequency of 300 Hz. [b,a] = butter(9,300/500,'high'); The filter's frequency response is freqz(b,a,128,1000) Example 2 Design a 10th-order bandpass Butterworth filter with a passband from 100 to 200 Hz and plot its impulse response, or unit sample response. n = 5; Wn = [100 200]/500; [b,a] = butter(n,Wn); [y,t] = impz(b,a,101); stem(t,y) 6. cheby1 Chebyshev Type I filter design (passband ripple) Syntax [b,a] = cheby1(n,Rp,Wn) [b,a] = cheby1(n,Rp,Wn,'ftype') [b,a] = cheby1(n,Rp,Wn,'s') [b,a] = cheby1(n,Rp,Wn,'ftype','s') [z,p,k] = cheby1(...) [A,B,C,D] = cheby1(...) Description cheby1 designs lowpass, bandpass, highpass, and bandstop digital and analog Chebyshev Type I filters. Chebyshev Type I filters are equiripple in the passband and monotonic in the stopband. Type I filters roll off faster than type II filters, but at the expense of greater deviation from unity in the passband. Digital Domain [b,a] = cheby1(n,Rp,Wn) designs an order n Chebyshev lowpass digital Chebyshev filter with cutoff frequency Wn and Rp dB of peak-to-peak ripple in the passband. It returns the filter coefficients in the length n+1 row vectors b and a, with coefficients in descending powers of z. Cutoff frequency is the frequency at which the magnitude response of the filter is equal to -Rp dB. For cheby1, the cutoff frequency Wn is a number between 0 and 1, where 1 corresponds to the Nyquist frequency, π radians per sample. Smaller values of passband ripple Rp lead to wider transition widths (shallower rolloff characteristics). If Wn is a two-element vector, Wn = [w1 w2], cheby1 returns an order 2*n bandpass filter with passband w1 <ω< w2. [b,a] = cheby1(n,Rp,Wn,'ftype') designs a highpass or bandstop filter, where the string 'ftype' is either: l 'high' for a highpass digital filter with cutoff frequency Wn l 'stop' for an order 2*n bandstop digital filter if Wn is a two-element vector, Wn = [w1 w2] The stopband is w1 <ω< w2. With different numbers of output arguments, cheby1 directly obtains other realizations of the filter. To obtain zero-pole-gain form, use three output arguments as shown below. [z,p,k] = cheby1(n,Rp,Wn) or [z,p,k] = cheby1(n,Rp,Wn,'ftype') returns the zeros and poles in length n column vectors z and p and the gain in the scalar k. Analog Domain [b,a] = cheby1(n,Rp,Wn,'s') designs an order n lowpass analog Chebyshev Type I filter with cutoff frequency Wn rad/s. It returns the filter coefficients in length n+1 row vectors b and a, in descending powers of s, derived from the transfer function Cutoff frequency is the frequency at which the magnitude response of the filter is -Rp dB. For cheby1, the cutoff frequency Wn must be greater than 0 rad/s. If Wn is a two-element vector Wn = [w1 w2] with w1 < w2, then cheby1(n,Rp,Wn,'s') returns an order 2*n bandpass analog filter with passband w1 <ω< w2. [b,a] = cheby1(n,Rp,Wn,'ftype','s') designs a highpass or bandstop filter. You can supply different numbers of output arguments for cheby1 to directly obtain other realizations of the analog filter. To obtain zero-pole-gain form, use three output arguments as shown below. [z,p,k] = cheby1(n,Rp,Wn,'s') or [z,p,k] = cheby1(n,Rp,Wn,'ftype','s') returns the zeros and poles in length n or 2*n column vectors z and p and the gain in the scalar k. Examples Example 1: Lowpass Filter For data sampled at 1000 Hz, design a 9th-order lowpass Chebyshev Type I filter with 0.5 dB of ripple in the passband and a cutoff frequency of 300 Hz. [b,a] = cheby1(9,0.5,300/500); The frequency response of the filter is freqz(b,a,512,1000) Example 2: Bandpass Filter Design a 10th-order bandpass Chebyshev Type I filter with a passband from 100 to 200 Hz and plot its impulse response. n = 10; Rp = 0.5; Wn = [100 200]/500; [b,a] = cheby1(n,Rp,Wn); [y,t] = impz(b,a,101); stem(t,y) 7. conv Convolution and polynomial multiplication Syntax c = conv(a,b) Description c = conv(a,b) convolves vectors a and b. The convolution sum is where N is the maximum sequence length. The series is indexed from n + 1 and k + 1 instead of the usual n and k because MATLAB vectors run from 1 to n instead of from 0 to n-1. The conv function is part of the standard MATLAB language. Example The convolution of a = [1 2 3] and b = [4 5 6] is c = conv(a,b) c = 4 13 28 27 18 8. ellip Elliptic (Cauer) filter design Syntax [b,a] = ellip(n,Rp,Rs,Wn) [b,a] = ellip(n,Rp,Rs,Wn,'ftype') [b,a] = ellip(n,Rp,Rs,Wn,'s') [b,a] = ellip(n,Rp,Rs,Wn,'ftype','s') [z,p,k] = ellip(...) [A,B,C,D] = ellip(...) Description ellip designs lowpass, bandpass, highpass, and bandstop digital and analog elliptic filters. Elliptic filters offer steeper rolloff characteristics than Butterworth or Chebyshev filters, but are equiripple in both the pass- and stopbands. In general, elliptic filters meet given performance specifications with the lowest order of any filter type. Digital Domain [b,a] = ellip(n,Rp,Rs,Wn) designs an order n lowpass digital elliptic filter with cutoff frequency Wn, Rp dB of ripple in the passband, and a stopband Rs dB down from the peak value in the passband. It returns the filter coefficients in the length n+1 row vectors b and a, with coefficients in descending powers of z. The cutoff frequency is the edge of the passband, at which the magnitude response of the filter is -Rp dB. For ellip, the cutoff frequency Wn is a number between 0 and 1, where 1 corresponds to half the sampling frequency (Nyquist frequency). Smaller values of passband ripple Rp and larger values of stopband attenuation Rs both lead to wider transition widths (shallower rolloff characteristics). If Wn is a two-element vector, Wn = [w1 w2], ellip returns an order 2*n bandpass filter with passband w1 <ω< w2. [b,a] = ellip(n,Rp,Rs,Wn,'ftype') designs a highpass or bandstop filter, where the string 'ftype' is either: l 'high' for a highpass digital filter with cutoff frequency Wn l 'stop' for an order 2*n bandstop digital filter if Wn is a two-element vector, Wn = [w1 w2]. The stopband is w1 <ω< w2. With different numbers of output arguments, ellip directly obtains other realizations of the fil
    展开阅读全文
    提示  咨信网温馨提示:
    1、咨信平台为文档C2C交易模式,即用户上传的文档直接被用户下载,收益归上传人(含作者)所有;本站仅是提供信息存储空间和展示预览,仅对用户上传内容的表现方式做保护处理,对上载内容不做任何修改或编辑。所展示的作品文档包括内容和图片全部来源于网络用户和作者上传投稿,我们不确定上传用户享有完全著作权,根据《信息网络传播权保护条例》,如果侵犯了您的版权、权益或隐私,请联系我们,核实后会尽快下架及时删除,并可随时和客服了解处理情况,尊重保护知识产权我们共同努力。
    2、文档的总页数、文档格式和文档大小以系统显示为准(内容中显示的页数不一定正确),网站客服只以系统显示的页数、文件格式、文档大小作为仲裁依据,个别因单元格分列造成显示页码不一将协商解决,平台无法对文档的真实性、完整性、权威性、准确性、专业性及其观点立场做任何保证或承诺,下载前须认真查看,确认无误后再购买,务必慎重购买;若有违法违纪将进行移交司法处理,若涉侵权平台将进行基本处罚并下架。
    3、本站所有内容均由用户上传,付费前请自行鉴别,如您付费,意味着您已接受本站规则且自行承担风险,本站不进行额外附加服务,虚拟产品一经售出概不退款(未进行购买下载可退充值款),文档一经付费(服务费)、不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
    4、如你看到网页展示的文档有www.zixin.com.cn水印,是因预览和防盗链等技术需要对页面进行转换压缩成图而已,我们并不对上传的文档进行任何编辑或修改,文档下载后都不会有水印标识(原文档上传前个别存留的除外),下载后原文更清晰;试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓;PPT和DOC文档可被视为“模板”,允许上传人保留章节、目录结构的情况下删减部份的内容;PDF文档不管是原文档转换或图片扫描而得,本站不作要求视为允许,下载前可先查看【教您几个在下载文档中可以更好的避免被坑】。
    5、本文档所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用;网站提供的党政主题相关内容(国旗、国徽、党徽--等)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
    6、文档遇到问题,请及时联系平台进行协调解决,联系【微信客服】、【QQ客服】,若有其他问题请点击或扫码反馈【服务填表】;文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“【版权申诉】”,意见反馈和侵权处理邮箱:1219186828@qq.com;也可以拔打客服电话:0574-28810668;投诉电话:18658249818。

    开通VIP折扣优惠下载文档

    自信AI创作助手
    关于本文
    本文标题:实验用Matlab基本函数.doc
    链接地址:https://www.zixin.com.cn/doc/11987522.html
    页脚通栏广告

    Copyright ©2010-2026   All Rights Reserved  宁波自信网络信息技术有限公司 版权所有   |  客服电话:0574-28810668    微信客服:咨信网客服    投诉电话:18658249818   

    违法和不良信息举报邮箱:help@zixin.com.cn    文档合作和网站合作邮箱:fuwu@zixin.com.cn    意见反馈和侵权处理邮箱:1219186828@qq.com   | 证照中心

    12321jubao.png12321网络举报中心 电话:010-12321  jubao.png中国互联网举报中心 电话:12377   gongan.png浙公网安备33021202000488号  icp.png浙ICP备2021020529号-1 浙B2-20240490   


    关注我们 :微信公众号  抖音  微博  LOFTER               

    自信网络  |  ZixinNetwork