Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Problem 5: Code structure Write a function called analyze_data that takes a filename as its argument, and returns a dictionary with the following keys and
Problem 5: Code structure Write a function called analyze_data that takes a filename as its argument, and returns a dictionary with the following keys and the corresponding values: "c_initial': c_initial . 'c_max': c_max . 'c_final': c_final . 'rise_time': t_r 'peak_time': t_p 'perc_overshoot': percent_overshoot 'settling_time': T_s system_mass': m 'system_spring': k system_damping': C Replace your previous testing code in if __name__ == "__main__" so that the only output now is to print out all of the above parameters in alphabetical order from datal.csv, in the format key value, e.g. print(key, value). For instance, part of the output might look like: c_max 1.0 peak_time 2.05 perc_overshoot 25. 131951323 Write a function called backwards_filter which takes in a list and a positive integers and performs a backwards- looking mean filter with a customizable window size n. Unlike the mean filter from Lab 2, your filter should average points at the beginning even if the filter extends off the edge of the list. . For instance, if we have the list [0, 1, 2, 3, 4, 5] and n=3, the filter should turn the data into [0, 0.5, 1, 2, 3, 4]. . Modify analyze_data to accept a window_size argument which runs the position data through the above filter before computing the parameters. It should default to no filtering, i.e. a window size of 1. analyze_data('my_file.csv', window_size=5) ## 5-window filtering analyze_data('my_file.csv') ## No filtering Problem 5: Code structure Write a function called analyze_data that takes a filename as its argument, and returns a dictionary with the following keys and the corresponding values: "c_initial': c_initial . 'c_max': c_max . 'c_final': c_final . 'rise_time': t_r 'peak_time': t_p 'perc_overshoot': percent_overshoot 'settling_time': T_s system_mass': m 'system_spring': k system_damping': C Replace your previous testing code in if __name__ == "__main__" so that the only output now is to print out all of the above parameters in alphabetical order from datal.csv, in the format key value, e.g. print(key, value). For instance, part of the output might look like: c_max 1.0 peak_time 2.05 perc_overshoot 25. 131951323 Write a function called backwards_filter which takes in a list and a positive integers and performs a backwards- looking mean filter with a customizable window size n. Unlike the mean filter from Lab 2, your filter should average points at the beginning even if the filter extends off the edge of the list. . For instance, if we have the list [0, 1, 2, 3, 4, 5] and n=3, the filter should turn the data into [0, 0.5, 1, 2, 3, 4]. . Modify analyze_data to accept a window_size argument which runs the position data through the above filter before computing the parameters. It should default to no filtering, i.e. a window size of 1. analyze_data('my_file.csv', window_size=5) ## 5-window filtering analyze_data('my_file.csv') ## No filtering
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started