Effacer les filtres
Effacer les filtres

Associating numbers to a Vector and interpolating values in a Table?

1 vue (au cours des 30 derniers jours)
malik abdelli
malik abdelli le 29 Août 2023
Modifié(e) : Voss le 29 Août 2023
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 commentaires
dpb
dpb le 29 Août 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?
malik abdelli
malik abdelli le 29 Août 2023
Modifié(e) : malik abdelli le 29 Août 2023
Those are different masses.
But i already got the answer now.
Thanks

Connectez-vous pour commenter.

Réponse acceptée

Voss
Voss le 29 Août 2023
t = array2table(reshape(1:3*36,3,[]))
t = 3×36 table
Var1 Var2 Var3 Var4 Var5 Var6 Var7 Var8 Var9 Var10 Var11 Var12 Var13 Var14 Var15 Var16 Var17 Var18 Var19 Var20 Var21 Var22 Var23 Var24 Var25 Var26 Var27 Var28 Var29 Var30 Var31 Var32 Var33 Var34 Var35 Var36 ____ ____ ____ ____ ____ ____ ____ ____ ____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ _____ 1 4 7 10 13 16 19 22 25 28 31 34 37 40 43 46 49 52 55 58 61 64 67 70 73 76 79 82 85 88 91 94 97 100 103 106 2 5 8 11 14 17 20 23 26 29 32 35 38 41 44 47 50 53 56 59 62 65 68 71 74 77 80 83 86 89 92 95 98 101 104 107 3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 48 51 54 57 60 63 66 69 72 75 78 81 84 87 90 93 96 99 102 105 108
P_t = [250 400 550]
P_t = 1×3
250 400 550
P_new = [320 200]
P_new = 1×2
320 200
data_new = interp1(P_t, t{:,:}, P_new, 'linear', 'extrap')
data_new = 2×36
1.4667 4.4667 7.4667 10.4667 13.4667 16.4667 19.4667 22.4667 25.4667 28.4667 31.4667 34.4667 37.4667 40.4667 43.4667 46.4667 49.4667 52.4667 55.4667 58.4667 61.4667 64.4667 67.4667 70.4667 73.4667 76.4667 79.4667 82.4667 85.4667 88.4667 0.6667 3.6667 6.6667 9.6667 12.6667 15.6667 18.6667 21.6667 24.6667 27.6667 30.6667 33.6667 36.6667 39.6667 42.6667 45.6667 48.6667 51.6667 54.6667 57.6667 60.6667 63.6667 66.6667 69.6667 72.6667 75.6667 78.6667 81.6667 84.6667 87.6667
  2 commentaires
malik abdelli
malik abdelli le 29 Août 2023
Thank you this helped a lot :)
Voss
Voss le 29 Août 2023
Modifié(e) : Voss le 29 Août 2023
You're welcome!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Interactive Model Editing dans Help Center et File Exchange

Produits

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by