Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA Write a program that exhibits the behavior of a digital filter, which removes noise from a sampled signal. The filter removes noise by running

JAVA

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:

image text in transcribed

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 session:

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

FilterDriver Filter -DO 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 +main(args: Stringll:void +initialize): void +findY(input : double) : double +step() : void

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

Real Time Database And Information Systems Research Advances

Authors: Azer Bestavros ,Victor Fay-Wolfe

1st Edition

1461377803, 978-1461377801

More Books

Students also viewed these Databases questions

Question

Discuss the quality management system model.

Answered: 1 week ago

Question

Write an expression to test whether integer x is even. for python

Answered: 1 week ago