How do I sum a function in matlab?

2 ビュー (過去 30 日間)
Lid
Lid 2016 年 10 月 26 日
コメント済み: wgh Huang 2016 年 10 月 30 日
Hi,
how do I write a function in matlab, which includes a sum? My goal is to write a function which sums the Lagrange-polynomials..
Can somebody help me?

回答 (1 件)

Smith
Smith 2016 年 10 月 26 日
You can define a function using Anonymous function like this
f1 = @(x) x;
f2 = @(x) x.^2;
to get to sum of f1 and f2, f
f = @(x) f1(x)+f2(x);
and f is equal to x+x^2.
  1 件のコメント
wgh Huang
wgh Huang 2016 年 10 月 30 日
Cell array will help if there are a lot of functions, which are in a particular pattern.

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by