Extrapolate or copy map values outward to replace zeros in 2D array
Show older comments
I have some code setup to evaluate timeseries data - three channels of data: speed, flow, pressure. This data is generated by a system that monitors speed and flow, then makes a determination of pressure based on those parameters. Unfortunately I do not have access to the logic that converts speed/flow in to a pressure command.
Using a meshgrid and griddedData commands, I can reverse engineer a "map" that reflects this time series data. An example of this map is shown in the attached image. The actual map is much larger - thousands of rows/columns to provide more resolution - while the image below is reduced for simplicity.
The problem I am facing is that the only cells populated (for pressure) are at speed/flow combinations that have been observed in transient evaluated to make the map. When this map is then applied over additional data sets, there are intermittent zeros when an evaluated speed/flow point has no data in the map.
Example: Speed: 18, flow: 6 = 0. In reality, this system would have likely selected a pressure of approximately 180, similar to the cell just to the left. There are not normally large discontinuities in this data. I would like to be able to "extend" this reverse-engineered map 'outward' in all direction to account for future data that could be slightly outside the previously evaluated data.
A couple different methods would work: (1) extrapolate outward based on trends of existing data, (2) direct copy/paste of the neighboring cells for "X" number of rows/columns 'outward'
A challenge is that for different systems, this map shape can vary drastically. Sometimes the populated cells are as shown - with a 'vertical' edge at speed 17. Other times the map could be much wider, spreading to speed 26, but less flow, maybe stopping at 25 or 30.
While a "brute force" method to find zeros around the populated cells could probably be deployed, it does seem like there must be a surface/gridding method that could help. I've yet to find something in all my searching.
Thanks in advance for your help!

Accepted Answer
More Answers (0)
Categories
Find more on Interpolation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!