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!