How can I find it?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Furkan Ozkan
le 22 Juin 2021
Commenté : Furkan Ozkan
le 22 Juin 2021
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/660940/image.jpeg)
how can I find f(-0,3) on matlab?
0 commentaires
Réponse acceptée
Walter Roberson
le 22 Juin 2021
There is not just one answer: it depends upon what model function you use
x = [-0.4, 0, 0.4, 0.8, 1.2]
fx = [-0.204, -0.07, -0.006, 0.442, 1.658]
fx03 = interp1(x, fx, -0.3)
fx03s = interp1(x, fx, -0.3, 'spline')
p3 = polyfit(x, fx, 3);
fx03p3 = polyval(p3, -0.3)
The cubic fit looks pretty good.
Plus de réponses (1)
Chunru
le 22 Juin 2021
You can use interp1 to interpolate. 'doc interp1' for more details.
x = [-0.4 0 0.4 0.8 1.2];
f = [-0.204 -0.07 -0.006 0.442 1.658];
y = interp1(x, f, -0.3)
0 commentaires
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!