save the value in side the function file

I have 3 m-files let say:
function [f]=fun(g)
Myy=20*x^2; % Assume we know x matrix
f=Myy;
the 2nd file is
function [c]=bisect(fun,a,b)
Ma=fun(a);
Mb=fun(b)
c=(a+b)/2;
Third file:
a= 1; b=2;
c=bisect(@fun,a,b)
If I run the third file, how do I save (store) value of f every time, a,b is changed. Thanks

回答 (2 件)

Azzi Abdelmalek
Azzi Abdelmalek 2015 年 7 月 23 日

0 投票

k=0;
a= 1;
b=2;
k=k+1
c{k}=bisect(@fun,a,b)

1 件のコメント

Laura
Laura 2015 年 7 月 24 日
I tried that but it seems to be not working.

サインインしてコメントする。

Azzi Abdelmalek
Azzi Abdelmalek 2015 年 7 月 23 日

0 投票

k=0;
a= 1;
b=2;
k=k+1
c{k}=bisect(@fun,a,b)

カテゴリ

タグ

質問済み:

2015 年 7 月 23 日

コメント済み:

2015 年 7 月 24 日

Community Treasure Hunt

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

Start Hunting!

Translated by