Question: MATLAB problem: Implement following equation over the given MATLAB function and testbench: Function code: function [xa,xd,xd1,x_recon,fn,m]=Lab5_practice(A,b,f,fs,q) theta = b*pi/180; dt=.0001; dn=1/fs; fn=f/fs; t=0:dt:0.2; xa=A*sin(2*pi*f*t+theta); n=0:dn:0.2;

MATLAB problem:

Implement following equation over the given MATLAB function and testbench:

MATLAB problem: Implement following equation over the given MATLAB function and testbench:

Function code:

function [xa,xd,xd1,x_recon,fn,m]=Lab5_practice(A,b,f,fs,q)

theta = b*pi/180; dt=.0001; dn=1/fs; fn=f/fs; t=0:dt:0.2; xa=A*sin(2*pi*f*t+theta); n=0:dn:0.2; xd=A*sin(2*pi*f*n+theta); m=dn/dt;

xd1=A/q*round(xd/A*q); x_recon=interp1(1:length(xd1),xd1,1:1/m:length(xd1)); end

Testbench code:

clc; clear; close all; A=200; b=0; f=10; fs=2000; q=8; [xa,xd,xd1,x_recon,fn,m]=Lab5_practice(A,b,f,fs,q); t=linspace(0,0.2,length(xa)); %%Verification of Results subplot(2,2,1) plot(t,xa);grid on; title('Original(analog)signal') subplot(2,2,2) stem(xd);grid on; title('Discrete signal (after sampling)') subplot(2,2,3) stem(xd1);grid on; title('Discrete signal (after quantization)') subplot(2,2,4) plot(t,x_recon);grid on; title('Reconstructed signal')

x(t) = A* {-+ + 0.2 0.1 St

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!