関数ハンドルのスプライン補間の仕方
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
kazuma kaneda
le 25 Nov 2021
Commenté : kazuma kaneda
le 25 Nov 2021
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/812964/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/812969/image.png)
エラー: chckxy (行 24)
1 番目と 2 番目の入力は double 型または single 型でなければなりません。
エラー: spline (行 72)
[x,y,sizey,endslopes] = chckxy(x,y);
エラー: integral_solver (行 40)
aa = spline(x,a,xx);
関数ハンドルを用いると補間ができなくなるのでしょうか。
コードは以下のようになっています。
x = [0 1 2 3 5 7 8 10];
a = @(x)(x.^2);
xx = 0:.25:10;
aa = spline(x,a,xx);
plot(x,a,'o',xx,aa)
b = @(x) (x^3 + feval(a,x));
補間した関数を引数とした関数bを作ることを前提としています。
0 commentaires
Réponse acceptée
Hernia Baby
le 25 Nov 2021
aが関数ハンドルだからです。
一度xを代入してください。bも同様です。
x = [0 1 2 3 5 7 8 10];
a = @(x)(x.^2);
y = a(x);
xx = 0:.25:10;
yy = spline(x,y,xx);
plot(x,y,'o',xx,yy)
b = @(x) (x.^3 + feval(a,x));
y3 = b(x);
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!