Associating numbers to a Vector and interpolating values in a Table?
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
dpb
2023-8-29
Well, you have three pressure curves, that's kewl, but what's the second variable that generated 36 responses for each? Whassup w/ that?
采纳的回答
Voss
2023-8-29
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')
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Interactive Model Editing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!