Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help writing this JAVA program, any help is greatly appreciated! Write a program that exhibits the behavior of a digital filter, which removes noise

Need help writing this JAVA program, any help is greatly appreciated!

Write a program that exhibits the behavior of a digital filter, which removes noise from a sampled signal. The filter removes noise by running a sequence of sample values through a formula which generates a current output from current and previous inputs and previous outputs. For this demonstration, use the following formula, which describes either a Chebyshev second order lowpass filter or a Butterworth second order low-pass filter:

y = (x + 2 * x1 + x2) / D0 A1 * y1 A2 * y2,

In the above formula, x, x1, and x2 are the current input sample and the two previous input samples, respectively, and y, y1, and y2 are the current filtered output and the two previous filtered outputs, respectively. For a 1.0 dB-ripple Chebyshev filter, the coefficients have the following values: D0 = 6.57; A1 = -0.696; A2 = 0.378. For a 0.5 dB-ripple Chebyshev filter the coefficients have the following values: D0 = 5.22; A1 = -0.491; A2 = 0.302. For a Butterworth filter the coefficients have the following values: D0 = 6.94; A1 = -0.677; A2 = 0.254.

Make your program conform to the following UML class diagram:

FilterDriver

+main(args : String[]) : void

Filter

-D0 : double = 6.58

-A1 : double = -0.696

-A2 : double = 0.378

-x : double = 0.0

-x1 : double = 0.0

-x2 : double = 0.0

-y : double

-y1 : double = 0.0

-y2 : double = 0.0

+initialize() : void

+findY(input : double) : double

+step() : void

Algorithm:

In main, print the heading, call initialize, and input the desired number of steps. Then do the simulation with a for-loop that increments time as follows:

print time

input x

print findY(x)

step

The initialize method prompts for and inputs D0, A1, and A2.

The findY method computes y using the formula given above.

The step method copies values from later-time variables to earlier-time variables.

Sample run:

2ND ORDER CHEBYSHEV OR BUTTERWORTH LOW-PASS FILTER

Enter D0: 5.22

Enter A1: -0.491

Enter A2: 0.302

Enter number of steps to simulate:

10 time= 0, input= 0 output= 0

time= 1, input= 100 output= 19

time= 2, input= 0 output= 47

time= 3, input= 0 output= 36

time= 4, input= 0 output= 3

time= 5, input= 0 output= -9

time= 6, input= 0 output= -5

time= 7, input= 0 output= 0

time= 8, input= 0 output= 1

time= 9, input= 0 output= 0

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2010 Barcelona Spain September 2010 Proceedings Part 3 Lnai 6323

Authors: Jose L. Balcazar ,Francesco Bonchi ,Aristides Gionis ,Michele Sebag

2010th Edition

3642159389, 978-3642159381

More Books

Students also viewed these Databases questions

Question

Print documents should use fonts. O serif sans serif

Answered: 1 week ago

Question

What is meant by Career Planning and development ?

Answered: 1 week ago

Question

What are Fringe Benefits ? List out some.

Answered: 1 week ago