Associating numbers to a Vector and interpolating values in a Table?
2 views (last 30 days)
Show older comments
Hello
I have some data that i mesured at 3 different pressure levels. At 250 bar, 400bar and 550 bar. I wrote that data in a 3x36 Table where every row corresponds to 1 pressure level.
Because the pressure in my system can sometimes vary and doesnt always correspond to one of the levels mentioned above. I wanted to make a simulink system where i can interpolate and extrapolate the data in the different rows. For example if im at a pressure level of 320bar i want to interpolate the data at that pressure level from the data that i got in my table. Or if im at a pressure level of 200 bar i want to extrapolate the data at that pressure level.
My question is how can i make this work, i wanted to use the interpolation block but i dont really understand how im supposed to show simulink that everyone of those rows corresponds to 1 pressure level?
I would be very greatful for some advice even if its in matlab code because i can then follow the logic and translate that to simulink.
Thank you.
2 Comments
dpb
on 29 Aug 2023
Well, you have three pressure curves, that's kewl, but what's the second variable that generated 36 responses for each? Whassup w/ that?
Accepted Answer
Voss
on 29 Aug 2023
t = array2table(reshape(1:3*36,3,[]))
P_t = [250 400 550]
P_new = [320 200]
data_new = interp1(P_t, t{:,:}, P_new, 'linear', 'extrap')
2 Comments
More Answers (0)
See Also
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!