Question

Problem 1....... you can use Matlab The following Scilab code generates a 10-second “chirp” with discrete...

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 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);

Homework Answers

Answer #1

clear; clc;
Fs = 8000;
Nbits = 16;
tMax = 10;
N = Fs*tMax+1;
f = linspace(0.0,0.2,N);
x = zeros(size(f));
plot(f,x)
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);
pause % this will pause the programm after sounding the first.
% sleep(10000);

%% Adding new codes

% creating the low pass butterwidth filter
Fn = 800; % cut off frequency
n = 4; % order of the filter
[b,a] = butter(n,Fn/(Fs/2))
% b = zeros, a = poles of the TF
TF = tf(b,a);
imp_res = impulse(TF);
y_n = conv(imp_res,x);
y_n = y_n(1:length(f));
% Ploting the Y(n) with frequency
plot(f,y_n);
grid on
xlabel('frequency')
ylabel('y(n)')
title('frequency responce')
% Playing Y(n)
sound(y_n,Fs,Nbits);
% the output from the input and filter coefficients
y = filter(b,a,x)

% end program

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Problem 1 ...... you can use Matlan i got one so all what i need is...
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...
Problem 3 you can use Matlab and also i give u the Problem 1 code its...
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;...
Question : Design the low and high pass filter for the signal, x(t) = 10 sin...
Question : Design the low and high pass filter for the signal, x(t) = 10 sin (10 t) + 1 sin (1000 t) by MATLAB Is below answer right? at ?High pass , 5row shouldn't this change from sin(100*t) ? sin(1000*t) x = 10*sin(10*t) + 1*sin(100*t); ?   x = 10*sin(10*t) + 1*sin(1000*t); ??? ..................................................................................................................................................... ?Low pass clc; rng default Fs=2000; t=linspace(0,1,Fs); x=10*sin(10*t)+sin(1000*t)%given signal n=0.5*randn(size(t));%noise x1=x+n; fc=150; Wn=(2/Fs)*fc; b=fir1(20,Wn,'low',kaiser(21,3)); %fvtool(b,1,’Fs’,Fs) y=filter(b,1,x1); plot(t,x1,t,y) xlim([0 0.1]) xlabel('Time (s) ') ylabel('Amplitude') legend('Original Signal','Filtered Data')...
1. Write a MATLAB function to determine the discrete-time Fourier Transform (H(?)) of the following sequence....
1. Write a MATLAB function to determine the discrete-time Fourier Transform (H(?)) of the following sequence. Plot its magnitude and phase. You can use the dtft command and use the abs, angle and plot commands to plot the results. x(n) = {4, 3, 2, 1, 2, 3, 4}. 2. Analytically determine H(z) and plot its magnitude and phase for the following system using freqz. y(n) = 2x(n) + x(n ? 1) ? 0.25y(n ? 1) + 0.25y(n ? 2). 3....
Problem 1 Consider the discrete-time LTI system characterized by the following difference equation with input and...
Problem 1 Consider the discrete-time LTI system characterized by the following difference equation with input and initial conditions specified: y[n] - 2 y[n-1] – 3 y[n-2] = x[n] , with y[0] = -1 and y[1] = 0, x[n] = (-1/2)n u[n-2]. ? Write a MATLAB program to simulate this difference equation. You may try the commands ‘filter’ or ‘filtic’ or create a loop to compute the values recursively. ? Printout and plot the values of the input signal, x[n] and...
Use Matlab to solve the following (a) Create a plot with a sphere at the center...
Use Matlab to solve the following (a) Create a plot with a sphere at the center of the graph (origin) representing the sun with a radius of 6955000 km. Make sure that the outside of the sphere is painted in ’autumn’ colors. (Hint: look up the sphere() function, the colormap() function, and the surf() function). (b) Create a variable t ranging from 0 to 2? with increments of 0.01. (c) The following Table gives you important values needed to compute...