Argument of a function includes another function

1 回表示 (過去 30 日間)
Nicole Stripling
Nicole Stripling 2019 年 10 月 14 日
回答済み: Walter Roberson 2019 年 10 月 14 日
Hi all,
I have a file called "fofx.m", and it has this function
function y = fofx(x)
y = cos(x) - sin(x);
end
In another file (same directory), I have
function [l,r,nf] = bisect(fname,a,b,tol)
if(a == b)
if(fname(a) == 0)
l = a;
r = l;
nf = 0;
return;
end
end
The evaluation of fname at a is giving me trouble. I get a different error message, no matter how I try get this function evaluated. How can I evaluate fname at a?

回答 (1 件)

Walter Roberson
Walter Roberson 2019 年 10 月 14 日
[leftbound, rightbound, whatever_nf_stands_for] = bisect(@fofx, some_a, some_b, tolerance_to_use);

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by