setSampleRate
Syntax
Description
Examples
Design two digital filters with these specifications:
A lowpass IIR filter with passband and stopband frequencies of 0.65π rad/sample and 0.80π rad/sample, respectively. The passband ripple is 1 dB and the stopband attenuation is 50 dB.
A bandstop IIR filter with passband ripples of 1 dB and stopband attenuation of 50 dB. The passband frequencies are 0.25π rad/sample and 0.34π rad/sample. The stopband frequencies are 0.36π rad/sample and 0.45π rad/sample.
d1 = designfilt("lowpassiir", ... PassbandFrequency=0.65,StopbandFrequency=0.80, ... PassbandRipple=1,StopbandAttenuation=50); d2 = designfilt("bandstopiir", ... PassbandFrequency1=0.25,StopbandFrequency1=0.34, ... StopbandFrequency2=0.36,PassbandFrequency2=0.45, ... PassbandRipple1=1,StopbandAttenuation=50, ... PassbandRipple2=1);
Cascade the lowpass IIR and bandstop IIR filters to form a digital filter cascade. The filter uses normalized frequency.
d = cascade(d1,d2)
d =
digitalFilter cascade with properties:
Stages:
Stage1: [1×1 digitalFilter]
Stage2: [1×1 digitalFilter]
Specifications:
NormalizedFrequency: 1
Use filterAnalyzer to visualize filter
Use filter to filter data
Set the sample rate of the digital filter cascade to 2.5 kHz and display the filter properties. The filter uses the specified sample rate.
setSampleRate(d,2.5e3) d
d =
digitalFilter cascade with properties:
Stages:
Stage1: [1×1 digitalFilter]
Stage2: [1×1 digitalFilter]
Specifications:
NormalizedFrequency: 0
SampleRate: 2500
Use filterAnalyzer to visualize filter
Use filter to filter data
Display the SampleRate property for each stage of the digital filter cascade. Each stage uses the specified sample rate.
d.Stage1.SampleRate
ans = 2500
d.Stage2.SampleRate
ans = 2500
Input Arguments
Digital filter, specified as a digitalFilter object. Use designfilt to generate a digital filter based on frequency-response
specifications.
Example: d = designfilt("lowpassiir",FilterOrder=3,HalfPowerFrequency=0.5)
specifies a third-order Butterworth filter with normalized 3 dB frequency 0.5π
rad/sample.
Sample rate of the cascaded filter, specified as one of these:
"normalized"—setSampleRatesets the digital filterdto use normalized frequency.Positive scalar —
setSampleRatesets the sample rate of the digital filterdtoFsHz.
Data Types: char | string | single | double
Version History
Introduced in R2026a
See Also
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)