Quad command

조회 수: 3 (최근 30일)
Cyberz
Cyberz 2012년 5월 16일
Is there a way to use the numeric quadrature functions (quad commands) with functions that change? Say I define some symbolic functions on x
for i=1:n
f(i)=sen(2*i*pi*x - 1)
end
And then I'd like to create matrix components, which are the integrals of those functions or a combinations of them, say:
for i=1:n
for j=1:n
A(i,j) = quad('f(i)*f(j)+2*i-3*j',0,L)
end
end
Is there a way to do this? With the '' in quad it just doesn't work. Thanks in advance.

채택된 답변

Cyberz
Cyberz 2012년 5월 16일
Found a way... say:
syms x
for i=1:n
f(i)=i*2*x-sin(2*i*x)
end
Then we may have a product of several functions...
d = f(p)*f(n)*f(i)*...
We can just use quadv with char command to solve it:
quadv(char(d),LowerLimit,UpperLimit)
:D

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Calculus에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by