subject

Write a JAVA program called SavitskyGolayFilterTest to implement this method using a test data set, which by design has perfectly smooth behavior. We will
subsequently apply this method to the analysis of real-world data.
Generate the test data set using this differentiable analytic function:
y = 12(x/150)^2 - 5e^(-((x-400)/20)^2)
It can be seen that this is the sum of a parabola and a Gaussian, for which an analytic
derivative can easily be found for comparison with the output of your program.
Generate an 800 point test data set and save it in a file called ParabolaPlusGaussian. txt.
One way to do this is to enter the function into Excel, then copy and paste 800 data
points corresponding to x = 0 to 799 into your .txt file. Your program can be hardcoded
to take in this .txt file without any user input.
Use Drawing Panel to display your results. Use an 800 x 400 panel, corresponding to
0 <= x <= 799 and 0 <= y <= 399. With the origin of your graph at (0,399), your plot
should fill the Drawing Panel nicely. Suggestion: for data point symbols, use drawOval
with a width and height of 1.
Savitzky-Golay convolution coefficients, appropriate for least-squares smoothing or
differentiation of evenly spaced digital data over a finite window, are shown below.
There are 12 different sets of coefficients, the largest of which contain 9 coefficients.
Load these coefficients into a 12 x 9 2-D array, padding the 3-, 5-, and 7-coefficient
sets with leading and trailing zeros as necessary to bring the coefficient count to 9 for
all sets. Your program should allow the user to choose any one of these sets by entering
a row index from 0 to 11. In the follow-up exercise using real data, we will emphasize
filter 8 (see also note below).
Coefficients for smoothing (not needed for test data)
quadratic or cubic
0 {-3,12,17,12,-3}
1 {-2,3,6,7,6,3,-2}
2 {-21,14,39,54,59,54,39,14,-21}
quartic or quintic
3 {5,-30,75,131,75,-30,5}
4 {15,-55,30,135,179,135,30,-55,15} Coefficients for 1st derivative
linear or quadratic
5 {-1,0,1}
6 {-2,-1,0,1,2}
7 {-3,-2,-1,0,1,2,3}
8 {-4,-3,-2,-1,0,1,2,3,4}
cubic or quartic
9 {1,-8,0,8,-1}
10 {22,-67,-58,0,58,67,-22}
11 {86,-142,-193,-126,0,126,193,142,-8 6}
Provide the user with a prompt to help select the desired set. You are welcome to use
this code, which includes zero padding, for the user prompt:

// provide user prompts to specify Savitsky-Golay coefficients
System. out. println("select Savitsky-Golay filter: ");
System. out. println("smoothing");
System. out. println(" quadratic or cubic");
System. out. println(" 0 { 0, 0,-3,12,17,12,-3, 0, 0}");
System. out. println(" 1 { 0,-2, 3, 6, 7, 6, 3,-2, 0}");
System. out. println(" 2 {-21,14,39,54,59,54,39,14,-21}"); System. out. println(" quartic or quintic");
System. out. println(" 3 { 0, 5,-30, 75,131, 75,-30, 5, 0}");
System. out. println(" 4 {15,-55, 30,135,179,135, 30,-55,15}");
System. out. println();
System. out. println("1st derivative");
System. out. println(" linear or quadratic");
System. out. println(" 5 { 0, 0, 0,-1,0,1,0,0,0}");
System. out. println(" 6 { 0, 0,-2,-1,0,1,2,0,0}");
System. out. println(" 7 { 0,-3,-2,-1,0,1,2,3,0}");
System. out. println(" 8 {-4,-3,-2,-1,0,1,2,3,4}");
System. out. println(" cubic or quartic");
System. out. println(" 9 { 0, 0, 1, -8,0, 8, -1, 0, 0}");
System. out. println(" 10 { 0, 22, -67, -58,0, 58, 67,-22, 0}");
System. out. println(" 11 {86,-142,-193,-126,0,126,193,142,-8 6}");
// select filter
System. out. print("Enter an integer 0 - 11 corresponding to desired filter: ");
int filterKey = console. nextInt();
System. out. println();

To avoid array-out-of-bounds complications at the beginning and end of your data,
filter your data starting at x = 5 and ending at 794.
For filter 8, scale your differentiated data by a factor of 4 so it can be visualized
on the same Drawing Panel plot, i. e. your end result should contain two curves: the
original data and its scaled first derivative.
Anticipating analysis of real-world data, assume that the horizontal axis is time,
that each unit in x represents one month, and that the first data point corresponds
to March 1958. Provide tick marks every two years starting in 1960, which should
result in the last tick mark corresponding to 2024.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 00:40
Reading characters and strings from the keyboard: consider the following c++ program 1. #include 2. #include 3. using namespace std; 4. mystring1 5. 6. int main() 7. { 8. 9. string mystring1, mystring2; mychar1 10. 11. 12. char mychar1, mychar2; 13. 14. cout< < "enter a string: "; mychar2 15. 16. cin> > mystring1; // 17. cin.get(mychar1); 18. cin> > mychar2; 19. getline(cin,mystring2); mystring2 20. 21. 22. cout<
Answers: 1
question
Computers and Technology, 22.06.2019 10:00
When is an original work considered public domain? a. when posted via social media b. when it is posted on the internet c. when a copyright symbol is not included with the piece of work d. when explicit permission is given by the author / owner
Answers: 1
question
Computers and Technology, 22.06.2019 12:30
What characteristic of long period comets suggest they come directly from the oort cloud?
Answers: 2
question
Computers and Technology, 23.06.2019 01:30
For a typical middle-income family, what is the estimated cost of raising a child to the age of 18? $145,500 $245,340 $304,340 $455,500
Answers: 2
You know the right answer?
Write a JAVA program called SavitskyGolayFilterTest to implement this method using a test data set...
Questions
question
Mathematics, 16.11.2020 14:00
question
Mathematics, 16.11.2020 14:00
question
Mathematics, 16.11.2020 14:00
question
Mathematics, 16.11.2020 14:00
question
Mathematics, 16.11.2020 14:00
question
Chemistry, 16.11.2020 14:00
Questions on the website: 13722367