why the code is incorrect? and where is incorrect? Matlab told me the function is incorrect, why?

조회 수: 2 (최근 30일)
fun = 2*exp(-x)+sin(x); % function
x0 = [3 4]; % initial interval
x = fzero(fun,x0)

채택된 답변

Stephen23
Stephen23 2023년 4월 24일
편집: Stephen23 2023년 4월 24일
"why the code is incorrect?"
FZERO expects its first input argument to be a function handle:
"and where is incorrect?"
You did not define a function handle, just like FZERO requires. I fixed that for you:
fun = @(x) 2*exp(-x)+sin(x);
% ^^^^ create anonymous function, FUN is its handle.
x0 = [3 4];
x = fzero(fun,x0)
x = 3.2215

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by