CODE:
clear all
alphap=1;
%passband attenuation in dB
alphas=15; %stopband attenuation in dB
wp=.2*pi; % passband freq. in radians
ws=.3*pi; % stopband freq. in radians
%to find cutoff freq. and order of the filter
[n,wn]=cheb1ord(wp/pi,ws/pi,alphap,alphas); %syatem
function of the filter
[b,a]=cheby1(n,alphap,wn);...
MATLAB CODE TO DESIGN A ELLIPTICAL LOW PASS FILTER
CODE:
clc;
clear
all;
N
= input('Order = ');
Fp
= input('Passband edge frequency in Hz = ');
Rp
= input('Passband ripple in dB = ');
Rs
= input('Minimum stopband attenuation in dB = ');
%
Determine the coefficients of the transfer function
[num,den]
= ellip(N,Rp,Rs,2*pi*Fp,'s');
%
Compute and plot the frequency response
omega
= [0: 200: 12000*pi];
h
= freqs(num,den,omega);
plot
(omega/(2*pi),20*log10(abs(h)));
xlabel('Frequency,
Hz'); ylabel('Gain, dB');...
MATLAB CODE TO DESIGN A BUTTERWORTH BAND REJECT FILTER
CODE:
clear all
alphap=2;
%passband attenuation in dB
alphas=20; %stopband attenuation in dB
wp=[.2*pi,.4*pi]; % passband freq. in radians
ws=[.1*pi,.5*pi]; % stopband freq. in radians
%to find cutoff freq. and order of the filter
[n,wn]=buttord(wp/pi,ws/pi,alphap,alphas) %syatem
function of the filter
[b,a]=butter(n,wn,'STOP')
w=0:.01:pi;...
MATLAB CODE TO DESIGN A BUTTERWORTH HIGHPASS FILTER
CODE:
clear all
alphap=.4;
%passband attenuation in dB
alphas=30; %stopband attenuation in dB
fp=400; %passband freq. in hz
fs=800; %stopband freq. in hz
F=2000; %sampling freq. in hz
omp=2*fp/F;oms=2*fs/F; % To find cutoff freq. and
order of the filter...
MATLAB CODE TO DESIGN A BUTTERWORTH BANDPASS FILTER
CODE:
clear all
alphap=2;
%passband attenuation in dB
alphas=20; %stopband attenuation in dB
wp=[.2*pi,.4*pi]; % passband freq. in radians
ws=[.1*pi,.5*pi]; % stopband freq. in radians
%to find cutoff freq. and order of the filter
[n,wn]=buttord(wp/pi,ws/pi,alphap,alphas) %syatem
function of the filte...
MATLAB CODE TO DESIGN A BUTTERWORTH LOWPASS FILTER

CODE:
Normal
0
false
false
false
EN-US
X-NONE
X-NONE
...
Matlab code for Computation of Linear convolution with DFT
Code:
clc;
clear
all;
g=input('Type
in the first sequence:');
h=input('Type
in the second sequence:');
ga=[g
zeros(1,length(h)-1)];
ha=[h
zeros(1,length(g)-1)];
G=fft(ga);
H=fft(ha);
Y=G.*H;...
MATLAB CODE TO FIND OUT THE DFT & IDFT THEN PLOT MANITUDE AND PHASE RESPONSE OF IT
CODE:
clc;
clear all;
close all;
x=input('enter the data sequence');
N=input('enter the N point DFT');
fs=input('enter the sample freq.');
Y=fft(x,N) %this will give DFT
f=fs/N;
G=ifft(Y,N)
%this will give
IDFT
z=0:f:((length(Y)-1)*f); ...
MATLAB CODE TO FIND OUT THE FREQUENCY AND PHASE RESPONSE

CODE:
clc;
clear all;
a=input('Enter the values for numerator : ');
b=input('Enter the values for denomator : ');
t = tf(a,b,0.1) %give transfer function in Z domain
freqz(a,b); % give freq as well as phase response
OUTPUT:
Enter the values for numerator : [1 2 3]
Enter the values for denomator : [4 5 6]
Transfer function:
z^2 +
2 z + 3
---------------
4 z^2 + 5 z + 6
Sampling time: 0.1
...
Matlab code for Addition of the signals frequnecy and amplitude value will be enter by user

Code:
Normal
0
false
false
false
EN-US
X-NONE
X-NONE
...
Subscribe to:
Posts (Atom)