Afficher commentaires plus anciens
#How can I write a polynomial function in matlab that can take 3 inputs to predict a forth element?
Thanks
Réponses (1)
Steven
le 5 Déc 2011
f = @(x,y,z)(x+y+z);
or
f = inline('x+y+z', 'x', 'y', 'z');
or
function f = myfun(x,y,z)
f = x+y+z;
return
give all
>> f(1,1,1) = 3
3 commentaires
Paulo Silva
le 5 Déc 2011
good answer, +1 vote, I hope that's what ali needs
ali Abusnina
le 5 Déc 2011
Steven
le 5 Déc 2011
you can write any function you want - I just showed you some basic examples - such as f = @(x,y,z)(2*x-4*y+pi*cos(z)). As I understand, you want to optimize your function, so you shold take a look at the optimization toolbox.
Catégories
En savoir plus sur Polynomials dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!