Using error in splinetool with more complicated functions
1 回表示 (過去 30 日間)
古いコメントを表示
Michelle Ghrist
2022 年 11 月 10 日
コメント済み: Michelle Ghrist
2022 年 11 月 10 日
In splinetool, I understand that I can see the error in a spline by giving the original function in this way:
>> splinetool
-> Input your own data
- Put vector of nodes in first box
- Put function in 3rd box, e.g., cos or exp
Q: How can I use a more complicated function, e.g., x*cos(x)? I've tried @(x) x.*cos(x), x*cos(x), etc. in the 3rd box, but I keep getting errors.
If you just give vectors of data points (or call splinetool(x,y)), you get error = 0 b/c MATLAB doesn't know the original function. How can I tell it the function?
0 件のコメント
採用された回答
John D'Errico
2022 年 11 月 10 日
Looks like the code is a bit buggy.
Save this function m-file on your search path.
function y = myfun(x)
y = x.*cos(x);
Then type the name myfun, into the field where it asks for a function name.
その他の回答 (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!