Error in fzero function

조회 수: 8 (최근 30일)
Sam Oznc
Sam Oznc 2018년 4월 9일
댓글: Sam Oznc 2018년 4월 9일
why i got this error and how can i fix this?
Thank you..
a=log(0.5)*log10(30)*sin(pi/6); b=0.5*(atan(0.5))*3^(1/5);
fzero('x^3+2*a-b',-1)
FZERO cannot continue because user-supplied expression ==> x^3+2*a-b failed with the error below.
Error in inline expression ==> x^3+2*a-b Undefined function or variable 'a'.

채택된 답변

James Tursa
James Tursa 2018년 4월 9일
Use a function handle. E.g.,
fzero(@(x)x^3+2*a-b,-1)
  댓글 수: 1
Sam Oznc
Sam Oznc 2018년 4월 9일
Oh you are awesome. Thank you

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

추가 답변 (0개)

카테고리

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