Input argument

3 Ansichten (letzte 30 Tage)
fatma
fatma am 1 Nov. 2011
function y = f1(x)
% A univariate function with a simple zero
syms x
y = cos(x) - x;
r = fzero('f1', 0.5)
It gives the following error
Error in ==> oct3 at 5 r = fzero('f1', 0.5) >>

Antworten (2)

bym
bym am 1 Nov. 2011
try
r = fzero(@f1,.5)

Walter Roberson
Walter Roberson am 2 Nov. 2011
Why is the error in the file oct3 when all you show us is the file f1 ?
What is the error message you are getting?
  1 Kommentar
fatma
fatma am 2 Nov. 2011
??? Input argument "x" is undefined.
Error in ==> oct3 at 4
y = cos(x) - x;
This error allows happen in similar programs considering "x" is undefined

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Nonlinear Optimization finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by