How to use multi-variable functions as inputs.

This is what I am trying to do
f = @(x1,x2,x3)x.^2+3.*x2.^2+4.*x3.^2-2.*x1.*x2+5.*x1+3.*x2+2.*x3;
ezplot(f)
fminsearch(f,[0,0,0])
I keep getting error saying not enough input arguments for fminsearch and I want to plot that function but not sure how?

 채택된 답변

Star Strider
Star Strider 2015년 6월 3일
편집: Star Strider 2015년 6월 3일

0 개 추천

You need to parameterise your functions so that x(1)=x1, x(2)=x2, and so forth. Then your function is: f=@(x)... with the appropriate expression following it.
Then use fsolve if you have the Optimization Toolbox.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Programming에 대해 자세히 알아보기

질문:

2015년 6월 3일

편집:

2015년 6월 3일

Community Treasure Hunt

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

Start Hunting!

Translated by