Alternative Methods for Interpolation or Solutions of Interpolation Errors
조회 수: 5 (최근 30일)
이전 댓글 표시
Hi everbody.
Sometimes i give an error when making interpolation process for ex. "The values of X should be distinct error".
I have an exam this tuesday which will be done by matlab. And i am afraid of interpolation errors.
What are the alternative methods for interpolation or solutions of errors like "The values of X should be distinct" etc.?
Thanks a lot.
댓글 수: 0
답변 (2개)
Walter Roberson
2015년 12월 7일
The available techniques depend a great deal upon whether the Y corresponding to the duplicate X are the same or different.
If the Y values are the same then the major technique is to unique() the X values and take the corresponding Y values. One way of doing that is to use
XY = [X(:), Y(:)];
uXY = unique(XY,'rows');
uX = uXY(:,1);
uY = uXY(:,2);
interp1(uX, uY, locations_to_interpolate_at)
But typically one would instead construct the X values to be unique.
What are some circumstances under which you have had difficulty with duplicate X values?
댓글 수: 0
Volkan Yangin
2015년 12월 7일
댓글 수: 3
John D'Errico
2015년 12월 7일
Please do not add answers every time you wish to comment. Use the COMMENTS!!!!!!!!
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!