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