I was in a lab and recorded some data from 2 pressure sensors. One worked perfectly (red line), the other one would send random data occasionally (blue line.) All of my values are supposed to be between 20 and 50 in my csv file, but i have random spikes on the bad sensor to -200, +1000, etc. I can write a simple algorithm to limit the change from the previous value to X%, but sometimes I have normal, expected changes in pressure that are larger than the random spikes (for example I have a legitimate jump from 26.337 to 49.6068 in successive data points at about x=1400.) I am trying to filter this data in Matlab. Here's the best I can get at a simple filter, but anything with a tighter limit (1% change from previous data point on any data outside my absolute limits of 20 and 50) and I lose real data.