Polynomial

조회 수: 2 (최근 30일)
ali Abusnina
ali Abusnina 2011년 12월 5일
#How can I write a polynomial function in matlab that can take 3 inputs to predict a forth element?
Thanks

답변 (1개)

Steven
Steven 2011년 12월 5일
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
ali Abusnina
ali Abusnina 2011년 12월 5일
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 2011년 12월 5일
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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Problem-Based Optimization Setup에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by