Modify the Matlab code to do the following: 1. Make x1 a four second cosine pure tone with analog frequency 1 kHz and pl

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

Modify the Matlab code to do the following: 1. Make x1 a four second cosine pure tone with analog frequency 1 kHz and pl

Post by answerhappygod »

Modify The Matlab Code To Do The Following 1 Make X1 A Four Second Cosine Pure Tone With Analog Frequency 1 Khz And Pl 1
Modify The Matlab Code To Do The Following 1 Make X1 A Four Second Cosine Pure Tone With Analog Frequency 1 Khz And Pl 1 (55.22 KiB) Viewed 34 times
Modify The Matlab Code To Do The Following 1 Make X1 A Four Second Cosine Pure Tone With Analog Frequency 1 Khz And Pl 2
Modify The Matlab Code To Do The Following 1 Make X1 A Four Second Cosine Pure Tone With Analog Frequency 1 Khz And Pl 2 (77.77 KiB) Viewed 34 times
Modify The Matlab Code To Do The Following 1 Make X1 A Four Second Cosine Pure Tone With Analog Frequency 1 Khz And Pl 3
Modify The Matlab Code To Do The Following 1 Make X1 A Four Second Cosine Pure Tone With Analog Frequency 1 Khz And Pl 3 (70.91 KiB) Viewed 34 times
Modify the Matlab code to do the following: 1. Make x1 a four second cosine pure tone with analog frequency 1 kHz and play it through the sound card. 2. Make x2 a four second cosine pure tone with analog frequency 3 kHz and play it through the sound card. 3. Make x3 = x1 + x2 and play x3 through the sound card. 4. Apply a lowpass digital Butterworth filter to x3 to keep the 1 kHz pure tone but filter out the 3 kHz pure tone. You can use 1 dB for the maximum passband ripple Rp and 60 dB for the minimum stopband attenuation Rs. You will need to set the passband edge frequency 1 kHz. Note that this is 2 x 1000/Fs in radian digital frequency. Divide that by to get the minimum value for the normalized digital passband edge frequency Wp. You will need to set the stopband edge frequency 3 kHz. This is 27 x 3000/Fs in radian digital frequency. Divide that by π to get the maximum value for the normalized digital passband edge frequency Ws. 5. Play the lowpass filtered signal through the sound card.
clear, close all Fs = 44100; % sampling frequency in Hz N = Fs* 4; % length of the 4 sec signal n = 0:N-1; % discrete time variable f_analog = 250; % pure tone analog frequency w_dig = 2*pi*f_analog/Fs; radian digital frequency x1 = cos (w_dig * n); % the pure tone sound (x1, Fs, 16); % play it through sound card pause (5); % wait for sound card to clear f_start_analog = 1000; w_start_dig = 2*pi*f_start_analog/Fs; f_stop_analog = 3000; w_stop_dig M 2*pi*f_stop_analog/Fs; phi M (w_stop_dig-w_start_dig)/(2* (N-1))*(n.*n) + w_start_dig*n; x2 = cos(phi); sound (x2, Fs, 16); % play it through sound card pause (5); % wait for sound card to clear x3 = x1 + x2; x3 = x3 / max (abs(x3)); % normalize the range to [-1,1] sound (x3,Fs,16); % play it through sound card pause (5); % wait for sound card to clear Wp = w_dig/pi; % normalized passband edge freq Ws = w_start_dig/pi; % normalized stopband edge freq Rp = 1; % max passband ripple Rs = 60; % min stopband attenuation [Nf, Wn] [num, den] buttord (Wp, Ws, Rp, Rs); % design filter order butter (Nf, Wn); % design the filter h-fvtool (num, den); % show frequency response figure (2); freqz (num, den, 1024); % plot frequency response title('Lowpass Frequency Response'); y1 = filter (num, den, x3); % apply the filter y1 = y1 / max (abs(y1)); % normalize filtered signal sound (y1,Fs,16); % play it through sound card pause (5); % wait for sound card to clear Ws = w_dig/pi; % normalized stopband edge freq
Wp H Ws = w_dig/pi; % normalized stopband edge freq w_start_dig/pi; % normalized passband edge freq 1; % max passband ripple Rp = Rs = 60; % min stopband attenuation E [Nf, Wn] = buttord (Wp, Ws, Rp, Rs); % design filter order [num2, den2] butter (Nf, wn, 'high'); % design the filter dfilt.df1(num2, den2); % make filter object addfilter (h, Hd); % add filter 2 to fvtool figure (3); Hd E freqz (num2, den2, 1024); % plot frequency response title(' Highpass Frequency Response'); y2 = filter (num2, den2, x3); % apply the filter y2 = y2 / max (abs(y2)); % normalize filtered signal sound (y2, Fs,16); % play it through sound card
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply