Polynomial

2 visualizaciones (últimos 30 días)
ali Abusnina
ali Abusnina el 5 de Dic. de 2011
#How can I write a polynomial function in matlab that can take 3 inputs to predict a forth element?
Thanks

Respuestas (1)

Steven
Steven el 5 de Dic. de 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 comentarios
ali Abusnina
ali Abusnina el 5 de Dic. de 2011
Thanks for your help. do you mean my prediction will be just based on summing up the prevoius three inputs? is there any coeffecients in the functions to be optimized?
Steven
Steven el 5 de Dic. de 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.

Iniciar sesión para comentar.

Categorías

Más información sobre Polynomials en Help Center y File Exchange.

Etiquetas

Aún no se han introducido etiquetas.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by