Integrating a multivariate function (5 variables)
9 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Michael Elman
el 29 de Dic. de 2019
Respondida: Thiago Henrique Gomes Lobato
el 29 de Dic. de 2019
I have a monster function that i need to integrate and plot, this is the function:

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)
0 comentarios
Respuestas (1)
Thiago Henrique Gomes Lobato
el 29 de Dic. de 2019
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?
0 comentarios
Ver también
Categorías
Más información sobre Calculus en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!