Im using the integral2 function and getting an error as shown below. i tried all possible ways to solve it but again the same error is coming. Kindy provide me with an answer

3 次查看(过去 30 天)
Code:
clear;
clc;
L=90e-6;
B=4.5e-6;
H=2e-6;
alpha=2.51e-6;
C=711;
T0=300;
K=170;
rho=2300;
nu=0.2;
E=165.81e9;
G=E/(2*(1+nu));
% considering the entire length of the section
syms x y
N1=(1/(1*L*H))*(x-L)*(y-H);
N2=(1/(1*L*H))*(x)*(y-H);
N3=(1/(1*L*H))*(x)*(y);
N4=(1/(1*L*H))*(x-L)*(y);
N=[N1 N2 N3 N4];
f=(K*((diff(N,x,1)*diff(N',x,1))+(diff(N,y,1)*diff(N',y,1))));
fun1= @(x,y)(f);
Ke=integral2(fun1,0,L,0,H);
My error:
Error using integral2Calc>integral2t/tensor (line 231)
Input function must return 'double' or 'single' values. Found 'sym'.
Error in integral2Calc>integral2t (line 55)
[Qsub,esub] = tensor(thetaL,thetaR,phiB,phiT);
Error in integral2Calc (line 9)
[q,errbnd] = integral2t(fun,xmin,xmax,ymin,ymax,optionstruct);
Error in integral2 (line 106)
Q = integral2Calc(fun,xmin,xmax,yminfun,ymaxfun,opstruct);
Error in paulfem (line 23)
Ke=integral2(fun1,0,L,0,H);

采纳的回答

Walter Roberson
Walter Roberson 2016-5-12
fun1= matlabFunction(f,'vars', [x y]);

更多回答(1 个)

Steven Lord
Steven Lord 2016-5-12
The integral2 function performs numeric integration. To integrate a symbolic expression with integral2 you would need to create a function handle from it using matlabFunction as Walter showed. Alternately call the int function twice to perform symbolic integration.

类别

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