Azzera filtri
Azzera filtri

Integration of function of 3 variables

1 visualizzazione (ultimi 30 giorni)
Nikhil
Nikhil il 21 Dic 2015
Risposto: Star Strider il 21 Dic 2015
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

Risposte (1)

Star Strider
Star Strider il 21 Dic 2015
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

Community Treasure Hunt

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

Start Hunting!

Translated by