How to do symbolic interpolation in matlab?
24 次查看(过去 30 天)
显示 更早的评论
Hellow friends!
I need to do symbolic interpolation in matlab but after spending a day I had no success. You might say
why I do not use function handle. The reason is that I need to perform a lot of differentiations with this
spline interpolant which is not possible with function handles. For simplicity, consider this 1D interpolation
problem: Assume that x=1:5 but my y-Data are symbolic as bellow:
x=1:5;
y=sym('y', [1 5]);
pp=spline(x,y);
Also, something like the following would be suitable for me but it also does not work:
syms x f(x)
x1=1:5;
f(x)=@(y)spline(x1,y,x);
Any idea?
0 个评论
回答(1 个)
John D'Errico
2022-1-11
编辑:John D'Errico
2022-1-11
You cannot define a symbolic spline. At least not in MATLAB. Could you write such a code? Well, yes. But you would need to understand splines well enough to write the code yourself. Functions like spline or even interp1 are not designed to accept symbolic input. Sorry, but they are not, nor do I know of one in MATLAB that can do so. (Could I write it? Certainly yes. But I won't.)
As for what you want to do that you could not do, this we do not really know, only that you did not know how to do what you need to do. Just wanting to do many interpolations is not that hard, so your real problem may just be in how to structure your code to be efficient. We don't know what the real issue is, only what you think to be the issue.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!