reverse of fnval: evaluate the variable for given value of function
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi everyone~
See the picture. The blue dots are my data. I want to find out at what x values the function drop to -20 (red circles). Is there something that I can use to do this?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/154166/image.png)
It feels like a reverse of fnval. Using fnval, we find out f(x) for a given x, based on interpolation. Now I want to find out x for a given f(x).
Any help's appreciated. Thanks a lot~ Happy holidays~
댓글 수: 0
채택된 답변
Amit
2013년 12월 27일
편집: Amit
2013년 12월 27일
If you have the plot in matlab, that means you must have (x,f(x)) data to begin with. If this is the only data set you are looking for then one simplest thing that can be done is using 'data cursor' on the figure to find out the the values for (x,f(x)) before and after the -20 threshold and then use linear interpolation to approximate the value of x at which f(x) = -20.
Another automated way would be
fzero(@(a) interp1(x,f(x),a,'spline')- (-20),a0)
where a0 is the guess value.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Spline Postprocessing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!