PROBLEM 6 (10pts) in the class Let's set the filter_simulation.m code that we covered. (N=2001, T=2, td=200*dT, wd=W/30)

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

PROBLEM 6 (10pts) in the class Let's set the filter_simulation.m code that we covered. (N=2001, T=2, td=200*dT, wd=W/30)

Post by answerhappygod »

Problem 6 10pts In The Class Let S Set The Filter Simulation M Code That We Covered N 2001 T 2 Td 200 Dt Wd W 30 1
Problem 6 10pts In The Class Let S Set The Filter Simulation M Code That We Covered N 2001 T 2 Td 200 Dt Wd W 30 1 (62.23 KiB) Viewed 20 times
I would like to know the solution and answer to the problems
above using the matlab code below.
%% sound signal Fourier Transform
% Filtering experiment
clear all;
clc;
close all;
% time domain axis
N=2001; % number of samples
T=2; % Time domain size
dT=T/N; % time sampling interval
W=2*pi/dT; % Angular frequency domain size
dW=W/N; % angualr frequency sampling interval
Ta=0:dT:T-dT; % sample time point grid : center value
sampling
Wa=-W/2 +dW/2 : dW : W/2 -dW/2;
%
% figure(504);
% plot(Ta,cos(Wa((N+1)/2+4)*Ta)); %
td=200*dT; % time-delay
% low-pass filter in frequency domain
wd=W/30 ; % rectangular function width
rectF=zeros(N,1);
for k=1:N

if abs(Wa(k)) < wd/2
rectF(k)=1*exp(-1i*td*Wa(k));
end

end
FtR=(1/(2*pi))*(N)*ifft(fftshift(rectF))*dW; % Inverse FT:
frequency->time
figure(3);
subplot(1,2,1); plot(Wa,abs(rectF)); title(' H(jw)');
xlabel('w-axis');
subplot(1,2,2); plot(Ta,abs(FtR)); title(' h(t)');
xlabel('t-axis');
set(gca,'fontsize',16);
% truncated low-pass filter
tFtR=zeros(N,1);
for k=1:N

if abs(Ta(k)-td)<td

tFtR(k)=real(FtR(k)); % real number
end
end
trectF=ifftshift(fft(tFtR))*dT; % Forward FT:
time->frequency
ht = tFtR(td/dT-td/dT+1:td/dT+td/dT); % impulse response
figure(4);
subplot(1,2,1); plot(Wa,abs(trectF)); title(' H(jw)');
xlabel('w-axis');
subplot(1,2,2); plot(Ta,abs(tFtR)); title(' h(t)');
xlabel('t-axis');
set(gca,'fontsize',16);
%% convolution integral: y(t)=h(t)*x(t) =
intetal(0-t)x(tau)*h(t-tau)*dtau
ws=Wa( (N+1)/2 +60 ); %
f_signal1=cos(ws*Ta); %
x=f_signal1';
y=zeros(N,1);
figure(54);
plot(Ta,x);
title(' x(t)'); xlabel('t-axis');
set(gca,'fontsize',16);
yf=zeros(N,1);
xf=zeros(N,1);
for t_cnt=1:N
% convolution integral : y(t)=h(t)*x(t) =
intetal(0-t)x(tau)*h(t-tau)*dtau
for k=1:t_cnt
if t_cnt - k+1 >0 && t_cnt - k+1 <=length(ht)
y(t_cnt)=y(t_cnt) + x(k)*ht(t_cnt - k+1)*dT;
end

end % for k=1:t_cnt
xf(1:t_cnt)=x(1:t_cnt); % input
yf(1:t_cnt)=y(1:t_cnt); % output

figure(6);
plot(Ta,xf);
hold on;
plot(Ta,yf,'r'); ylim([-1 1]);
pause(0.1);
hold off;

end % for t_cnt=1:N
%% Do it yourself
Show transcribed image text
PROBLEM 6 (10pts) in the class Let's set the filter_simulation.m code that we covered. (N=2001, T=2, td=200*dT, wd=W/30) convolution integral: y(t)-h convolution integral: y(t)=ht ws-Wa( (N+1)/2 +20 ); f_signal1=cos(ws Ta); % x=f_signal1'; y-zeros(N, 1); For each case, the following response can be obtained. 0.8 0.6 0.4 0.2 - 0.8 0.6 0.4 0.2 OFW -0.2 -0.4 -0.6 -0.8 -1 ws-Wa( (N+1)/2 +50); X f_signal1=cos(ws* Ta): % x=f_signal1'; y-zeros(N.1); U of -0.2 -0.4 -0.6 -0.8 -1 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1 (a) Write the input, output, and impulse response of this experiment as a formula, and describe the relationship between output, input, and impulse response. (b) The output between t=0s and t=0.3s shows aperiodic transient response characteristics. Discuss the cause. (c) Using MATLAB, analyze and discuss the frequency response characteristics of the above system.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply