how to realize look up function in m script
이전 댓글 표시
hello, i have x axle table and y axle table, when i set value within the range of x, how to get the output from y, may be some interpolation and curve smoothing should used. i hope it works in m script.

댓글 수: 8
Mathieu NOE
2024년 7월 5일
hello
sure , you can use interpolation (with interp1 ) or you can also fit a polynomial with polyfit
wenchao zhang
2024년 7월 5일
편집: wenchao zhang
2024년 7월 5일
Star Strider
2024년 7월 5일
The interp1 function has several method options, depending on what you want to do.
For example:
xi = 90;
yi = interp1(x, y, xi, 'linear')
yi = interp1(x, y, xi, 'pchip')
To find a value of ‘x’ that corresponds to a specific value of ‘y’, simply reverse the arguments:
yi = 90;
xi = interp1(y, x, yi, 'linear')
xi = interp1(y, x, yi, 'pchip')
Fortunately, ‘y’ appears to be a monotonically increasing function of ‘x’. If that were not the situation, it would be necessary to determine the approximate indices of the ‘x’ values where ‘y’ crossed a specific value, and then interpolate in each region in a for loop.
.
Mathieu NOE
2024년 7월 5일
if you can , share yur data and we can show you some options (if you are unsure how to proceed)
wenchao zhang
2024년 7월 5일
wenchao zhang
2024년 7월 5일
Walter Roberson
2024년 7월 5일
xi = interp1(y, x, yi, 'linear', 'extrap')
wenchao zhang
2024년 7월 6일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Smoothing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
