Question

**Problem 1 ...... you can use Matlan i got one so all
what i need is 2, 3 and 4 one of them or all of them ..
thanks**

The following Scilab code generates a 10-second “chirp” with discrete frequencies ranging from 0 to 0.2 with a sampling frequency of 8 kHz.

clear; Fs = 8000;

Nbits = 16;

tMax = 10;

N = Fs*tMax+1;

f = linspace(0.0,0.2,N);

x = zeros(f);

phi = 0;

for n=0:N-1 x(n+1) = 0.8*sin(phi);

phi = phi+2*%pi*f(n+1); end sound(x,Fs,Nbits);

sleep(10000); //allows full sound to play Add code that calculates and plays y (n)=h(n)?x (n) where h(n) is the impulse response of an IIR lowpass filter with cutoff frequency 800 Hz and based on a 4th order Butterworth prototype. You should also generate a plot of y (n) vs. frequency (plot(f,y);). Name your program p1.sce Calculate the output from the input and filter coefficients using the following command: y = filter(b,a,x);

**Problem 2**

Using the same initial code fragment as in Problem 1, add code that calculates and plays y (n)=h(n)?x (n) where h(n) is the impulse response of an IIR highpass filter with cutoff frequency 800 Hz and based on a 4th order Butterworth prototype. Name your program p2.sce

**Problem 3**

Using the same initial code fragment as in Problem 1, add code that calculates and plays y (n)=h(n)?x (n) where h(n) is the impulse response of an IIR bandpass filter with band edge frequencies 750 Hz and 850 Hz and based on a 4th order Butterworth prototype. Name your program p3.sce

**Problem 4**

Using the same initial code fragment as in Problem 1, add code that calculates and plays y (n)=h(n)?x (n) where h(n) is the impulse response of an IIR bandstop filter with band edge frequencies 750 Hz and 850 Hz and based on a 4th order Butterworth prototype. Name your program p3.sce

Answer #1

I Have solved all questions except 3.

MATLAB code is given below in bold letters.

**clear all ;close all;
Fs = 8000;**

**Nbits = 16;**

**tMax = 10;**

**N = Fs*tMax+1;**

**f = linspace(0.0,0.2,N);**

**x = zeros(f);**

**phi = 0;**

**for n=0:N-1
x(n+1) = 0.8*sin(phi);
phi = phi+2*pi*f(n+1);
end
sound(x,Fs,Nbits);**

**% sleep(10000);**

**% Low pass filter
Wn = 800/8000; % rad/sample**

**[b,a] = butter(4,Wn);**

**y = filter(b,a,x);
sound(y,Fs,Nbits);
figure;plot(f,y);title('f vs y for low pass')
% High pass filter
clear Wn a b y;
Wn = 800/8000; % rad/sample**

**[b,a] = butter(4,Wn,'high');**

**y = filter(b,a,x);
sound(y,Fs,Nbits);
figure;plot(f,y);title('f vs y for High pass');
% Band stop filter
clear Wn a b y;
Wn = [750 850]/8000; % rad/sample**

**[b,a] = butter(4,Wn,'stop');**

**y = filter(b,a,x);
sound(y,Fs,Nbits);
figure;plot(f,y);title('f vs y for Band stop');**

Problem 3 you can use Matlab and also i give u the Problem 1
code its on Matlab
Using the same initial code fragment as in Problem 1, add code
that calculates and plays y (n)=h(n)?x (n) where h(n) is the
impulse response of an IIR bandpass filter with band edge
frequencies 750 Hz and 850 Hz and based on a 4th order Butterworth
prototype. Name your program p3.sce
this is the Problem 1 code and the solutin
clear; clc;...

Problem 1....... you can use Matlab
The following Scilab code generates a 10-second “chirp” with
discrete frequencies ranging from 0 to 0.2 with a sampling
frequency of 8 kHz.
clear;
Fs = 8000;
Nbits = 16;
tMax = 10;
N = Fs*tMax+1;
f = linspace(0.0,0.2,N);
x = zeros(f);
phi = 0;
for n=0:N-1 x(n+1) = 0.8*sin(phi);
phi = phi+2*%pi*f(n+1);
end sound(x,Fs,Nbits);
sleep(10000); //allows full sound to play
Add code that calculates and plays y (n)=h(n)?x (n) where h(n)
is the...

ADVERTISEMENT

Get Answers For Free

Most questions answered within 1 hours.

ADVERTISEMENT

asked 10 minutes ago

asked 31 minutes ago

asked 41 minutes ago

asked 42 minutes ago

asked 42 minutes ago

asked 46 minutes ago

asked 50 minutes ago

asked 55 minutes ago

asked 1 hour ago

asked 1 hour ago

asked 1 hour ago

asked 1 hour ago