필터 지우기
필터 지우기

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 CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by