Integration of function of 3 variables

조회 수: 3 (최근 30일)
Nikhil
Nikhil 2015년 12월 21일
답변: Star Strider 2015년 12월 21일
Hello Everybody, I am trying to integrate a function 'fun' of 3 variables 'x,t,y'. Initially I want to integrate this function with respect to 'x' and 't' over certain range. Then I want to evaluate resultant expression in 'y', at different values of 'y'. The Matlab code that I have written is as follows:
clear all;
K=44.5;
rho=7850;
Cp=475;
k=K/(rho*Cp);
V=20e-3;
l=12e-3;
L=V*l/k;
q=1e6;
syms x t y
fun=@(x,t,y) ((2*q)./(4*pi*K.*t)).*exp(-((-y+V*t-x).^2)./(4*k.*t));
xmin=-l;
xmax=l;
tmin=0;
tmax=Inf;
funty=int(fun,x,xmin,xmax);
funy=int(funty,t,tmin,tmax);
subs(funy,y,-l)
After running this code, I am not getting any numerical answer. Can somebody please tell me where am I going wrong here? In the end I expect numerical answer around 88. Any help in this matter would be appreciated. Thank you in advance,
Nik

답변 (1개)

Star Strider
Star Strider 2015년 12월 21일
The symbolic Math Toolbox prefers symbolic functions, not anonymous functions. Omitting the initial constants:
syms x t y
fun(x,t,y) = ((2*q)./(4*pi*K.*t)).*exp(-((-y+V*t-x).^2)./(4*k.*t));
xmin=-l;
xmax=l;
tmin=0;
tmax=Inf;
funty=int(fun,x,xmin,xmax);
funy=int(funty,t,tmin,tmax);
SymResult = subs(funy,y,-l);
NumResult = vpa(SymResult, 15)
NumResult(y) =
8.53663791307516

카테고리

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