From the course: Practice It C++: Common Data Structures
Unlock the full course today
Join today to access over 24,900 courses taught by industry experts.
Check it: Anomaly detection - C++ Tutorial
From the course: Practice It C++: Common Data Structures
Check it: Anomaly detection
(soft electronic noise) - [Instructor] Okay, here's my solution to the anomaly detector. I've included the necessary headers and the using namespace std directive. Next, I define the sensor data class. I'll include the private member readings. It should be a list of type double and I'll name it readings. In the public section, I'll start with the add reading method. (keys clack) It takes a single argument of type double the reading value. This method will add new readings to the readings list by calling the lists pushback method and I'll pass in the value. The smooth data method is a bit more involved. Its purpose is to replace any spike or dip with the previous sensor reading. The list needs to have a minimum of two elements to make this work. If the list has less than two nodes, I will just return. If readings dot size is less than two, I'll simply return. To get rid of spikes and dips, I'll use two…