In lab 2, assignment 2, you implemented a smoothing system using convolution with a box of length N and height 1/N: h₁ [

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: 899603
Joined: Mon Aug 02, 2021 8:13 am

In lab 2, assignment 2, you implemented a smoothing system using convolution with a box of length N and height 1/N: h₁ [

Post by answerhappygod »

In Lab 2 Assignment 2 You Implemented A Smoothing System Using Convolution With A Box Of Length N And Height 1 N H 1
In Lab 2 Assignment 2 You Implemented A Smoothing System Using Convolution With A Box Of Length N And Height 1 N H 1 (20.88 KiB) Viewed 34 times
'From lab 2...
In Lab 2 Assignment 2 You Implemented A Smoothing System Using Convolution With A Box Of Length N And Height 1 N H 2
In Lab 2 Assignment 2 You Implemented A Smoothing System Using Convolution With A Box Of Length N And Height 1 N H 2 (51.85 KiB) Viewed 34 times
In Lab 2 Assignment 2 You Implemented A Smoothing System Using Convolution With A Box Of Length N And Height 1 N H 3
In Lab 2 Assignment 2 You Implemented A Smoothing System Using Convolution With A Box Of Length N And Height 1 N H 3 (48.15 KiB) Viewed 34 times
In lab 2, assignment 2, you implemented a smoothing system using convolution with a box of length N and height 1/N: h₁ [n] = (u[n] - u[n — N])/N. Find the coefficients {a, b} of the linear constant coefficient difference equation (LCCDE) describing this system for N=10. Find the coefficients for the system h₁ [n] = 0.8¹u[n]

# Assignment 2- Amplitude Operations on Signals # Part A # set up relevant parameters srate = 1000 # sampling rate in Hz time = np.arange(0,2,1/srate) n = len(time) # length of the time vector # here is a base signal to work with, values of signal points chosen randomly = 10 # points for piecewise linear signal Р amp = 20 # amplitude range of base signal base = np. interp(np. linspace(0,p,n), np.arange(0,p), np. random. rand (p)*amp) # create some random noise to be added to the abve base signals noiseamp = 2 noise = noiseamp * np.random.randn(n) noisy = base + noise # add noise to the base signals to create new noisy signals # TODO: Code that solves the rest of A fig = plt.figure(1, figsize = (8,8)) plt.subplot (211) plt.ylim(0, 25) plt.plot(time, base) plt.title('original signals') plt.xlabel('sample number') plt.ylabel('base') plt.subplot(212) plt.ylim(0,25) plt.plot(time, noisy) plt.title('noisy signals') plt.xlabel('sample number') plt.ylabel('noisy') fig.tight_layout() # associated time vector that corresponds to 2 seconds

# Part B # implement the running mean filter with a for loop # TODO: Code that solves B filtsigl = noisy.copy() k = 20 for i in range(20, 1980): mean = np.mean(filtsigl[i − k : i+k]) filtsigl = mean fig2= plt.figure(2, figsize = (8,8)) plt.plot(time, noisy) plt.plot(time, filtsigl) plt.title('filtsig1') fig2.tight_layout() # Part C # implement smoothing using convolution # TODO: Code that solves C N = 2 * k + 1 hfilt = np.zeros( [N]) hfilt = hfilt + 1/N filtsig2= np.convolve(base, hfilt) fig3 = plt.figure(3, figsize = (8,8)) new_time = np.arange(0, len(filtsig2) / 1000, 1/srate) plt.plot(new_time, filtsig2) plt.plot(time, filtsig1) plt.title('filtsig2') fig3.tight_layout() #Assignment 2 hint: using a for loop, consider a "sliding window" as follows: x=np.arange (10) print('x = ',x) for k in range(0,5): | print('k=',k,', window = ',x[k:k+3]) print('etc...')
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply