problem with fzero in my code

조회 수: 1 (최근 30일)
Hanna Sundling
Hanna Sundling 2019년 10월 14일
댓글: Walter Roberson 2019년 10월 15일
fzero won´t work, anyone knows what may be the problem?
Skärmavbild 2019-10-14 kl. 08.29.30.png
  댓글 수: 1
Hanna Sundling
Hanna Sundling 2019년 10월 14일
This is the error message I get
Skärmavbild 2019-10-14 kl. 08.31.51.png

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

답변 (2개)

Fabio Freschi
Fabio Freschi 2019년 10월 14일
your fun is neither acceppting nor using inputs
You should write the symbolic function like this
fun = @(x)cos(x);
x0 = fzero(fun,0.5);
  댓글 수: 8
Hanna Sundling
Hanna Sundling 2019년 10월 14일
I am also going to find how many tangents lines that goes torugh the origin for cosx and that is why I talk abot xsinx in my comments.
Walter Roberson
Walter Roberson 2019년 10월 15일
I do not understand what tangent lines through the origin for cosx has to do with xsinx ? Tangent lines to cosx would have to do with sinx not xsinx .

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


Ekemini Stephen
Ekemini Stephen 2019년 10월 14일
Create a function file and save it to the same dierctory as
function y = f(x)
y = cos(x);
end
Then use this function in the section of your script as
%%
fun = @f; % function
x0 = 0.5; % initial point
ff = fzero(fun,x0);

카테고리

Help CenterFile Exchange에서 Numerical Integration and Differentiation에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by