Interpolation from a table by using two variables
显示 更早的评论
Hello i have a slight problem and it is kinda urgent to be honest. I can be considered as a noobie in MATLAB so i ask for forgiveness.
I am working on a rocket trajectory simulation project and i have a dataset acquired from CFD analysis for sea level altitudes of 0,3000,6000 meters and Mach number from 0 to 2.0 by step of 0.1. I created a loop by creating a time array and i can get previous results of Mach and altitude work in the next step, altough my problem is that i want to be able to get value of cd for ie. M=0.25 and h=1230 m in the loop, so far my advances are halted.
Here is the dataset in question, and i am dropping the .csv file if you feel use of.
NaN 0 3000 6000
0 0 0 0
0.1 0.4340 0.45120 0.47110
0.2 0.39540 0.40990 0.42670
0.3 0.37520 0.38850 0.40360
0.4 0.36170 0.37410 0.38820
0.5 0.35150 0.36330 0.37670
0.6 0.34290 0.35420 0.3670
0.7 0.33590 0.34680 0.35920
0.8 0.33090 0.34150 0.35360
0.9 0.32930 0.33980 0.35190
1 0.370 0.38050 0.39240
1.1 0.41110 0.42050 0.43130
1.2 0.39960 0.40830 0.41810
1.3 0.39950 0.40790 0.41750
1.4 0.39080 0.3990 0.40830
1.5 0.3820 0.390 0.39910
1.6 0.36960 0.37730 0.38620
1.7 0.35750 0.36510 0.37380
1.8 0.34610 0.35350 0.3620
1.9 0.3350 0.34230 0.35060
2 0.32440 0.33150 0.33960
So far i had some unsuccesfull attempts by using interp2 as i really could not undersand and use it. Sadly i do not have any meaningful code to show here.
采纳的回答
更多回答(1 个)
Torsten
2022-5-3
X = 0:3000:6000;
Y = 0:0.1:2;
Z = [0 0 0
0.4340 0.45120 0.47110
0.39540 0.40990 0.42670
0.37520 0.38850 0.40360
0.36170 0.37410 0.38820
0.35150 0.36330 0.37670
0.34290 0.35420 0.3670
0.33590 0.34680 0.35920
0.33090 0.34150 0.35360
0.32930 0.33980 0.35190
0.370 0.38050 0.39240
0.41110 0.42050 0.43130
0.39960 0.40830 0.41810
0.39950 0.40790 0.41750
0.39080 0.3990 0.40830
0.3820 0.390 0.39910
0.36960 0.37730 0.38620
0.35750 0.36510 0.37380
0.34610 0.35350 0.3620
0.3350 0.34230 0.35060
0.32440 0.33150 0.33960];
Xq = 2000;
Yq = 0.55;
Zq = interp2(X,Y,Z,Xq,Yq)
类别
在 帮助中心 和 File Exchange 中查找有关 Tables 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!