Frequency Response - MATLAB & Simulink - MathWorks United Kingdom (2024)

Frequency Response

Digital Domain

freqz uses an FFT-basedalgorithm to calculate the Z-transform frequency response of a digitalfilter. Specifically, the statement

[h,w] = freqz(b,a,p)

returns the p-point complex frequency response, H(ejω),of the digital filter.

H(ejω)=b(1)+b(2)ejω+...+b(n+1)ejωna(1)+a(2)ejω+...+a(m+1)ejωm

In its simplest form, freqz accepts the filtercoefficient vectors b and a,and an integer p specifying the number of pointsat which to calculate the frequency response. freqz returnsthe complex frequency response in vector h, andthe actual frequency points in vector w in rad/s.

freqz can accept other parameters, such asa sampling frequency or a vector of arbitrary frequency points. Theexample below finds the 256-point frequency response for a 12th-orderChebyshev Type I filter. The call to freqz specifiesa sampling frequency fs of 1000 Hz:

[b,a] = cheby1(12,0.5,200/500);[h,f] = freqz(b,a,256,1000);

Because the parameter list includes a sampling frequency, freqz returnsa vector f that contains the 256 frequency pointsbetween 0 and fs/2 used in the frequency responsecalculation.

Note

This toolbox uses the convention that unit frequency is theNyquist frequency, defined as half the sampling frequency. The cutofffrequency parameter for all basic filter design functions is normalizedby the Nyquist frequency. For a system with a 1000Hzsampling frequency, for example, 300Hz is 300/500=0.6. To convert normalized frequencyto angular frequency around the unit circle, multiply byπ.To convert normalized frequency back to hertz, multiply by half thesample frequency.

If you call freqz with no output arguments,it plots both magnitude versus frequency and phase versus frequency.For example, a ninth-order Butterworth lowpass filter with a cutofffrequency of 400 Hz, based on a 2000 Hz sampling frequency, is

[b,a] = butter(9,400/1000);

To calculate the 256-point complex frequency response for thisfilter, and plot the magnitude and phase with freqz,use

freqz(b,a,256,2000)

freqz can also accept a vector of arbitraryfrequency points for use in the frequency response calculation. Forexample,

w = linspace(0,pi);h = freqz(b,a,w);

calculates the complex frequency response at the frequency pointsinw for the filter defined byvectors b anda.The frequency points can range from 0 to 2π.To specify a frequency vector that ranges from zero to your samplingfrequency, include both the frequency vector and the sampling frequencyvalue in the parameter list.

These examples show how to compute and display digital frequencyresponses.

Frequency Response from Transfer Function

Open Live Script

Compute and display the magnitude response of the third-order IIR lowpass filter described by the following transfer function:

H(z)=0.05634(1+z-1)(1-1.0166z-1+z-2)(1-0.683z-1)(1-1.4461z-1+0.7957z-2).

Express the numerator and denominator as polynomial convolutions. Find the frequency response at 2001 points spanning the complete unit circle.

b0 = 0.05634;b1 = [1 1];b2 = [1 -1.0166 1];a1 = [1 -0.683];a2 = [1 -1.4461 0.7957];b = b0*conv(b1,b2);a = conv(a1,a2);[h,w] = freqz(b,a,'whole',2001);

Plot the magnitude response expressed in decibels.

plot(w/pi,20*log10(abs(h)))ax = gca;ax.YLim = [-100 20];ax.XTick = 0:.5:2;xlabel('Normalized Frequency (\times\pi rad/sample)')ylabel('Magnitude (dB)')

Frequency Response- MATLAB & Simulink- MathWorks United Kingdom (1)

Frequency Response of an FIR Bandpass Filter

Open Live Script

Design an FIR bandpass filter with passband between 0.35π and 0.8π rad/sample and 3 dB of ripple. The first stopband goes from 0 to 0.1π rad/sample and has an attenuation of 40 dB. The second stopband goes from 0.9π rad/sample to the Nyquist frequency and has an attenuation of 30 dB. Compute the frequency response. Plot its magnitude in both linear units and decibels. Highlight the passband.

sf1 = 0.1;pf1 = 0.35;pf2 = 0.8;sf2 = 0.9;pb = linspace(pf1,pf2,1e3)*pi;bp = designfilt('bandpassfir', ... 'StopbandAttenuation1',40, 'StopbandFrequency1',sf1,... 'PassbandFrequency1',pf1,'PassbandRipple',3,'PassbandFrequency2',pf2, ... 'StopbandFrequency2',sf2,'StopbandAttenuation2',30);[h,w] = freqz(bp,1024);hpb = freqz(bp,pb);subplot(2,1,1)plot(w/pi,abs(h),pb/pi,abs(hpb),'.-')axis([0 1 -1 2])legend('Response','Passband','Location','South')ylabel('Magnitude')subplot(2,1,2)plot(w/pi,db(h),pb/pi,db(hpb),'.-')axis([0 1 -60 10])xlabel('Normalized Frequency (\times\pi rad/sample)')ylabel('Magnitude (dB)')

Frequency Response- MATLAB & Simulink- MathWorks United Kingdom (2)

Magnitude Response of a Highpass Filter

Open Live Script

Design a 3rd-order highpass Butterworth filter having a normalized 3-dB frequency of 0.5π rad/sample. Compute its frequency response. Express the magnitude response in decibels and plot it.

[b,a] = butter(3,0.5,'high');[h,w] = freqz(b,a);dB = mag2db(abs(h));plot(w/pi,dB)xlabel('\omega / \pi')ylabel('Magnitude (dB)')ylim([-82 5])

Frequency Response- MATLAB & Simulink- MathWorks United Kingdom (3)

Analog Domain

freqs evaluates frequencyresponse for an analog filter defined by two input coefficient vectors, b anda. Its operation is similar to thatof freqz; you can specify a number of frequencypoints to use, supply a vector of arbitrary frequency points, andplot the magnitude and phase response of the filter. This exampleshows how to compute and display analog frequency responses.

Comparison of Analog IIR Lowpass Filters

Open Live Script

Design a 5th-order analog Butterworth lowpass filter with a cutoff frequency of 2 GHz. Multiply by 2π to convert the frequency to radians per second. Compute the frequency response of the filter at 4096 points.

n = 5;fc = 2e9;[zb,pb,kb] = butter(n,2*pi*fc,"s");[bb,ab] = zp2tf(zb,pb,kb);[hb,wb] = freqs(bb,ab,4096);

Design a 5th-order Chebyshev Type I filter with the same edge frequency and 3 dB of passband ripple. Compute its frequency response.

[z1,p1,k1] = cheby1(n,3,2*pi*fc,"s");[b1,a1] = zp2tf(z1,p1,k1);[h1,w1] = freqs(b1,a1,4096);

Design a 5th-order Chebyshev Type II filter with the same edge frequency and 30 dB of stopband attenuation. Compute its frequency response.

[z2,p2,k2] = cheby2(n,30,2*pi*fc,"s");[b2,a2] = zp2tf(z2,p2,k2);[h2,w2] = freqs(b2,a2,4096);

Design a 5th-order elliptic filter with the same edge frequency, 3 dB of passband ripple, and 30 dB of stopband attenuation. Compute its frequency response.

[ze,pe,ke] = ellip(n,3,30,2*pi*fc,"s");[be,ae] = zp2tf(ze,pe,ke);[he,we] = freqs(be,ae,4096);

Design a 5th-order Bessel filter with the same edge frequency. Compute its frequency response.

[zf,pf,kf] = besself(n,2*pi*fc);[bf,af] = zp2tf(zf,pf,kf);[hf,wf] = freqs(bf,af,4096);

Plot the attenuation in decibels. Express the frequency in gigahertz. Compare the filters.

plot([wb w1 w2 we wf]/(2e9*pi), ... mag2db(abs([hb h1 h2 he hf])))axis([0 5 -45 5])gridxlabel("Frequency (GHz)")ylabel("Attenuation (dB)")legend(["butter" "cheby1" "cheby2" "ellip" "besself"])

Frequency Response- MATLAB & Simulink- MathWorks United Kingdom (4)

The Butterworth and Chebyshev Type II filters have flat passbands and wide transition bands. The Chebyshev Type I and elliptic filters roll off faster but have passband ripple. The frequency input to the Chebyshev Type II design function sets the beginning of the stopband rather than the end of the passband. The Bessel filter has approximately constant group delay along the passband.

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.

Frequency Response- MATLAB & Simulink- MathWorks United Kingdom (5)

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

Americas

  • América Latina (Español)
  • Canada (English)
  • United States (English)

Europe

  • 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
    • Deutsch
    • English
    • Français
  • United Kingdom (English)

Asia Pacific

  • Australia (English)
  • India (English)
  • New Zealand (English)
  • 中国
  • 日本 (日本語)
  • 한국 (한국어)

Contact your local office

Frequency Response
- MATLAB & Simulink
- MathWorks United Kingdom (2024)
Top Articles
Play Our Free Browser-Based Online Games - Plays.org
Top 10 websites to play unblocked games
Spasa Parish
Rentals for rent in Maastricht
159R Bus Schedule Pdf
Sallisaw Bin Store
Black Adam Showtimes Near Maya Cinemas Delano
Espn Transfer Portal Basketball
Pollen Levels Richmond
11 Best Sites Like The Chive For Funny Pictures and Memes
Things to do in Wichita Falls on weekends 12-15 September
Craigslist Pets Huntsville Alabama
Paulette Goddard | American Actress, Modern Times, Charlie Chaplin
What's the Difference Between Halal and Haram Meat & Food?
R/Skinwalker
Rugged Gentleman Barber Shop Martinsburg Wv
Jennifer Lenzini Leaving Ktiv
Justified - Streams, Episodenguide und News zur Serie
Epay. Medstarhealth.org
Olde Kegg Bar & Grill Portage Menu
Cubilabras
Half Inning In Which The Home Team Bats Crossword
Amazing Lash Bay Colony
Juego Friv Poki
Dirt Devil Ud70181 Parts Diagram
Truist Bank Open Saturday
Water Leaks in Your Car When It Rains? Common Causes & Fixes
What’s Closing at Disney World? A Complete Guide
New from Simply So Good - Cherry Apricot Slab Pie
Fungal Symbiote Terraria
modelo julia - PLAYBOARD
Poker News Views Gossip
Abby's Caribbean Cafe
Joanna Gaines Reveals Who Bought the 'Fixer Upper' Lake House and Her Favorite Features of the Milestone Project
Tri-State Dog Racing Results
Navy Qrs Supervisor Answers
Trade Chart Dave Richard
Lincoln Financial Field Section 110
Free Stuff Craigslist Roanoke Va
Stellaris Resolution
Wi Dept Of Regulation & Licensing
Pick N Pull Near Me [Locator Map + Guide + FAQ]
Crystal Westbrooks Nipple
Ice Hockey Dboard
Über 60 Prozent Rabatt auf E-Bikes: Aldi reduziert sämtliche Pedelecs stark im Preis - nur noch für kurze Zeit
Wie blocke ich einen Bot aus Boardman/USA - sellerforum.de
Infinity Pool Showtimes Near Maya Cinemas Bakersfield
Dermpathdiagnostics Com Pay Invoice
How To Use Price Chopper Points At Quiktrip
Maria Butina Bikini
Busted Newspaper Zapata Tx
Latest Posts
Article information

Author: Foster Heidenreich CPA

Last Updated:

Views: 6308

Rating: 4.6 / 5 (76 voted)

Reviews: 83% of readers found this page helpful

Author information

Name: Foster Heidenreich CPA

Birthday: 1995-01-14

Address: 55021 Usha Garden, North Larisa, DE 19209

Phone: +6812240846623

Job: Corporate Healthcare Strategist

Hobby: Singing, Listening to music, Rafting, LARPing, Gardening, Quilting, Rappelling

Introduction: My name is Foster Heidenreich CPA, I am a delightful, quaint, glorious, quaint, faithful, enchanting, fine person who loves writing and wants to share my knowledge and understanding with you.