fzero for f(x,y) where y is a m*m matrix

3 ビュー (過去 30 日間)
Lily
Lily 2015 年 4 月 28 日
コメント済み: Lily 2015 年 4 月 29 日
I know how to do it when yis a 1*m matrix, for example:
f1 = @(y,x) y-x.^2;
y=1:1:4;
arrayfun(@(i) fzero(@(x) f1(y(i),x),1),1:numel(y))
My question is how to do it when y is a m*m matrix. i.e. for each element of y, how can I find value of x that makes f3=0?
f3 = @(y,x) y-x.^2;
y=[1:0.5:2;2:1:4;3:1.5:6]
???

採用された回答

Joseph Cheng
Joseph Cheng 2015 年 4 月 28 日
you've got already. but all you need is one extra line to reshape f3 to be
[row col]=size(y);
reshape(ansfromarrayfun,row,col)
  1 件のコメント
Lily
Lily 2015 年 4 月 29 日
Thanks That really helps a lot.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeOptimization についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by