answersLogoWhite

0

% program to design butterworth low pass filter

clc;

clear all;

close all;

alphap=input ('enter the pass band ripple');

alphas=input('enter the stop band ripple');

fp=input('enter the pass band freq');

fs=input('enter the stop band freq');

F=input('enter the sampling freq');

omp=2*fp/F;oms=2*fp/F;

%to find cut off freq and order of the filter

[n,wn]=buttord(omp,,oms,alphap,alphas);

% system function of the filter

[b,a]=butter(n,wn,'step');

w=0:0.01:pi;

[h,om]=freq(b,a,w);

m=2*log(abe(h));

an=angle(h);

subplot(2,1,1);

plot(om/pi,m);

ylabel('magnitude');

xlabel(''om/pi);

title('magnitude');

subplot(2,1,2);

plot(om/pi,an);

ylabel('phase angle');

xlabel('om/pi');

title('phase angle');

User Avatar

Wiki User

14y ago

Still curious? Ask our experts.

Chat with our AI personalities

SteveSteve
Knowledge is a journey, you know? We'll get there.
Chat with Steve
RafaRafa
There's no fun in playing it safe. Why not try something a little unhinged?
Chat with Rafa
DevinDevin
I've poured enough drinks to know that people don't always want advice—they just want to talk.
Chat with Devin

Add your answer:

Earn +20 pts
Q: Using Butterworth Filter in Matlab
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Math & Arithmetic

How do you make graph from an equation in Matlab?

Initially, the equation can be directly realized using Matlab source code. Then various inputs can be applied to it. These values can easily be plotted on a graph using plot or stem command in Matlab.


Convolution in matlab using for loop?

There are a lot of convolution functions in matlab, mostly in the signal processing toolbox, so it depends on what you want to do. Matlab has extensive help files available online.


How do you modulate in matlab without using matlab tools?

You would have to write your own code for a modulation (Matlab has a convolution function not in the tools), otherwise you can use its built in function in the signal processing toolbox.


How do you convert sequence of images to video in matlab?

You can do this by selecting the sequence of images you want to animate and then using the Matlab's function called "im2frame". This will result in a video.


MATLAB code for FIR filter design in rectangular window using genetic algorithm?

Here is an example MATLAB code for designing an FIR filter with a rectangular window using a genetic algorithm: % Define the desired filter specifications Fs = 1000; % Sampling frequency Fc = 100; % Cutoff frequency N = 51; % Filter order % Define the fitness function for the genetic algorithm fitnessFunc = @(x) designFIR(x, Fs, Fc); % Define the genetic algorithm options options = optimoptions('ga', 'Display', 'iter', 'MaxGenerations', 100); % Run the genetic algorithm to find the optimal filter coefficients [x, fval] = ga(fitnessFunc, N, options); % Design the FIR filter using the obtained coefficients filter = fir1(N-1, x); % Plot the frequency response of the designed filter freqz(filter, 1, 1024, Fs); In the above code, designFIR is a user-defined function that evaluates the fitness of an FIR filter design based on its frequency response. The genetic algorithm is then used to optimize the filter coefficients to meet the desired specifications. Finally, the designed filter is plotted using the freqz function.