フィルターのクリア

How to nest functions?

1 回表示 (過去 30 日間)
Sergey Dukman
Sergey Dukman 2016 年 1 月 14 日
コメント済み: Sergey Dukman 2016 年 1 月 14 日
Hello, I have a function. Then I want to create another function and use the value of the first function to compute the second one. How can I "connect" these functions?
Regards, Sergey
  2 件のコメント
jgg
jgg 2016 年 1 月 14 日
編集済み: jgg 2016 年 1 月 14 日
I'm unclear what you want to do exactly. Functions can call each other:
F = @(X)(X + 2)
G = @(X)(2*F(X) + F(4))
G(F(2))
Are all valid.
Sergey Dukman
Sergey Dukman 2016 年 1 月 14 日
編集済み: Walter Roberson 2016 年 1 月 14 日
I have the following function:
function epsilon = d(N)
epsilon=23.45*(sind((360/365)*(284+N)));
end
Then I want to create another function in order to compute equation based on value of first function. Let's say that the value of the first function is A. Then the second function will be defined as
C=B*A.
Hopefully you understood :)

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

採用された回答

Walter Roberson
Walter Roberson 2016 年 1 月 14 日
Example:
d = @(N) 23.45*(sind((360/365)*(284+N)));
N = 0:20;
B = 98.8;
C = B .* d(N);
  1 件のコメント
Sergey Dukman
Sergey Dukman 2016 年 1 月 14 日
Thank you, sir

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by