Interpolate data with 2 variables
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
0 개 추천
Hi,
I've been given a set of random engine speeds and a set of random torques and the corresponding fuel consumption data for that point. To simplify it I have this;
Engine Speed [256 509 789 1250 1449 1976]
Torque [ 22 31 48 78 112 140]
Fuel consumption [ 2568 459 440 400 329 298]
I have now been given a set of engine speeds and toruqes to find the fuel consumption at that point. The matrix of engine speeds and toruqes are larger than the data I have. I believe I need to interpolate it into a 3D graph to get the values for these points.
How do I go about this?
Many thanks
채택된 답변
dpb
2019년 5월 3일
Your data are pretty sparse over the 2D space but you can try
F=scatteredInterpolant(S,T,F);
f=F(s,t);
where S,T,F are your data and s,t the lookup values.
댓글 수: 9
Ed Brown
2019년 5월 3일
Thanks for the reply, I've played around with that function but I would have to rewrite it for each lookup vlaue.
I have 13 torque look up values and 17 speed look up values. Therefore i would need hundreds of different lines of code. Is there a quicker way to do this? Make a martix of the look up values and use this?
dpb
2019년 5월 3일
I don't follow -- why would you have to rewrite anything? Just create the vector of input T,S values and pass to the Interpolant function object and it'll return all the results...
Actual examples are much easier to deal with than just word descriptions so understand talking same things...
Pretty sparse? That is an understatement if I ever saw one.
PLOT THE DATA!
plot(EngineSpeed,Torque,'o')

So there are 6 data points where information is supplied? They fall almost in a line. No interpolation method you would use here will make any sense of it at all, at least not unless the data seriously fills in the dependent variable space than this. It is confusing if the OP actually has more than those 6 points or not however.
Ed Brown
2019년 5월 3일
Thanks dpb I’ve created the input matrix and it works fine
dpb
2019년 5월 3일
Well, I didn't claim Ed would get good results necessarily, John, only that scatteredInterpolant will do the best it can with what it's given... :)
John D'Errico
2019년 5월 3일
:)
dpb
2019년 5월 3일
I did try a half dozen points scattered between low-high values for each of Speed,Torque and ScatteredInterpolant managed to put them in what at least appears reasonable locations on a scatter3 diagram...of course, as noted, the allowable space for the two variables is undoubtedly quite constrained to lie almost along the line, just not physically realizable otherwise.
John D'Errico
2019년 5월 4일
편집: John D'Errico
2019년 5월 4일
The problem is, IF the space for yourr data to live in lies in such a narrow region, then you will find it very difficult to build a valid interpolant.
Such scattered interpolants tend to rely on triangulations of your data.
tri = delaunayTriangulation(EngineSpeed',Torque');
trimesh(tri.ConnectivityList,EngineSpeed,Torque)

Now, envision how the interpolant works. Given any point that you need to compute the fuel consumption for, the interpolant will decide which of those very long, very thin triangles the point lies inside. Once having done that, it uses linear interpolation inside the triangle, taking the fuel consumption at the 3 corner vertices of that triangle. This tends to be a VERY bad thing to do.
In fact, it is probably worse if you use an interpolation that tries to be smoother than a linear interpolation on a problem like this.
And, of course, if the point that you want to interpolate does not fall inside any of those triangles, then all interpolation gets more difficult yet.
Instead, what you want is a situation like this:
[x,y] = meshgrid(1:5);
tri = delaunayTriangulation(x(:),y(:));
trimesh(tri.ConnectivityList,x(:),y(:))

This is a much better scenario for interpolation. We see small LOCAL triangles in this second figure. Any point in question uses only points that are near it to predict the value.
So if you want a good result from interpolation, then you need to populate the region of interest as well as possible.
dpb
2019년 5월 4일
No argument...
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Interpolation에 대해 자세히 알아보기
참고 항목
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
