필터 지우기
필터 지우기

Integrating a multivariate function (5 variables)

조회 수: 3 (최근 30일)
Michael Elman
Michael Elman 2019년 12월 29일
I have a monster function that i need to integrate and plot, this is the function:
function.PNG
I surfed and searched a lot of posts for a method to solve that, but in the end I failed, the best I did was:
syms w1 w0 w L g
fun(w1,w0,w,L,g)=2.*L.*g./pi.*(w1.^2/(((w0.^2-w1.^2).^2+g.^2.*w1.^2).*(w1.^2-w.^2)));
funt=int(fun,w1,0,Inf);
% SymResult = subs(funt,L,1);
% SymResult = subs(funt,w0,1);
% SymResult = subs(funt,g,1);
% SymResult = subs(funt,w,1);
% pretty(SymResult)
ezplot(SymResult)
But i get some monstrous result that even substitute function doesn't work... Is there any way to solve this numerically and to plot it?
Big thanks in advance.
(I tried to substitute values in the function, because ezplot can only plot function of one unknown)

답변 (1개)

Thiago Henrique Gomes Lobato
Thiago Henrique Gomes Lobato 2019년 12월 29일
You first have to define what you want to plot it. This seems to be a function of w, so, for different w's you want to integrate over w1 and all other values should be fixed, is that right? You can do it numerically as follows:
L = 0.1;
g = 2;
w0 = pi/4;
t = 1;
wvec = -2*pi:0.1:2*pi;
for w = wvec
fun = @(w1)2.*L.*g./pi.*(w1.^2./(((w0.^2-w1.^2).^2+g.^2.*w1.^2).*(w1.^2-w.^2)));
q(t) = integral(fun,0,Inf);
t = t+1;
end
figure,plot(wvec,q)
The main problem is that your function has a singularity at w=w1, which will create a division by zero and thus the result you get from the numerical integral will not be right, and also you cannot expect a reasonable value from the integral itself. Are you maybe missing some term in the equation?

카테고리

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