I've just noticed that actually using the interpolant to find my wind speed, air tempearture etc. at the desired location is also taking up a lot of time (60% of my overall run time) whilst the scattered interpolation takes up around 35% of my overall run time.
Speeding up interpolation with scattered interpolation
조회 수: 57 (최근 30일)
이전 댓글 표시
Hi,
I've been working on speeding up my code for a project and I've identified that I'm spending a lot of time interpolating my data. I have data for wind speeds, air temperature, pressure and a few other things that depend on position in the X,Y and Z directions. I've been using ScatteredInterpolation to interpolate across 1425 data points and then using the interpolant find the wind speeds, air temperature, pressure etc. at a specific position. I was wondering if there was a faster way to do this, either speeding up scatteredinterpolation or a different interpolating method. Am fairly new to MATLAB so help appreciated.
Thanks.
댓글 수: 4
Torsten
2023년 12월 10일
The points are spaced every 0.25 lat and long and there is data for 57 different altitudes.
If this is the case, why don't you use GriddedInterpolant instead of ScatteredInterpolant ? The interpolation afterwards will be much faster.
채택된 답변
Matt J
2023년 12월 10일
편집: Matt J
2023년 12월 10일
Your data is gridded, so you should be using griddedInterpolant, as opposed to scatteredInterpolant. Gridded interpolation is much faster than scattered interpolation.
TemperaturePrevious0 = griddedInterpolant( {LatData0,LonData0,AltitudeData0}, TemperatureArrayPrevious)
Also...
Once I've interpolated im using the interpolant to find the atmospheric properties at a given point.
...you should not interpolate one point at a time. You should supply a vector of query points and interpolate them in a single call.
댓글 수: 4
Matt J
2023년 12월 10일
I've tried the above code but i keep getting the following error:
It means one of the coordinates you are interpolating (Lat, Lon, Altitude) has less than two sample points.
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!