can i make a symbolic function without a specific formula?
이전 댓글 표시
If I have data in two vectors which represents x and y for any experiment and I want to make a symbolic function that can represent y as a function of x but i have no specific formula for y just the measurements between x and y . How i can do that is there any code for that other than interpolation??
답변 (2개)
Cris LaPierre
2018년 11월 14일
0 개 추천
I'm not sure interpolation would help you. My approach would be to visualize the data and then decide what type of equation to fit the data to.
Walter Roberson
2018년 11월 14일
syms XX
tt = num2cell( [XX == x(:),y(:)].' );
ff(XX) = piecewise(tt{:});
Now if I got everything right then ff should be a symbolic function such that if you input one of the values from x then it should return the corresponding value for y. For all other values it should return sym(nan)
This is not likely to be a useful function, but I guess you have your reasons for wanting it.
댓글 수: 3
ghghgh
2018년 11월 15일
ghghgh
2018년 11월 15일
Walter Roberson
2018년 11월 15일
No, you are mistaken . You do want NaN for ff(2.5) You were quite clear in your original question ,
How i can do that is there any code for that other than interpolation??
Interpolation is the word that covers all possible techniques for forecasting intermediate values based upon known values . When you said "other than interpolation" then you indicated that absolutely no forecasting was to be permitted, that the function should only ever return the values already known and never ever any other value . And that is what my code does for you .
카테고리
도움말 센터 및 File Exchange에서 Numeric Solvers에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!