필터 지우기
필터 지우기

User Defined Values with Integral and integral2

조회 수: 4 (최근 30일)
Chad
Chad 2017년 4월 18일
답변: Steven Lord 2017년 4월 18일
Dear Forum,
I am trying to integrate a function with pre-defined values. For example, I want to integrate;
L = 7.5; x_l = [0:.1:L]; r_l = x_l*2;
{Yn = integral(@myfun,0,L)
function f=myfun(x)
f = (D+x)/((D+x)^2+r_l^2);
end}
The variable r_l is defined from x_l. How do I use x_l instead of x to evaluate this integral?

답변 (1개)

Steven Lord
Steven Lord 2017년 4월 18일
The integral documentation page has a link to a page that discusses how to pass additional parameters into the integrand function with which you call integral. While the examples on that page use fzero as the "function function" being called, the techniques work with integral as well.

카테고리

Help CenterFile Exchange에서 Numerical Integration and Differentiation에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by