The last line is wrong. The system reminds that "Input function must return 'double' or 'single' values. Found 'sym'." How can I obtain the constant matrix K after integral ?
Show older comments
%%%%%I would like to obtain the constant matrix K
clc
clear
h=0.03;
E=1*10^9;
miu=0.3;
df1=[1;0;0];
df2=[0;1;0];
e1=[1;0;0];
e2=[0;1;0];
e3=[0;0;1];
D=(E/(1-miu*miu))*[1,miu,0;miu,1,0;0,0,(1-miu)/2];
syms xta eta
Bm=zeros(3,3,'sym');
Bb=zeros(3,3,'sym');
K=zeros(3,3,'sym');
M=@(xta)(xta>=0&xta<0.5).*(((0.5-xta)./0.5).*((0.5-xta)./0.5)); %% Define a piecewise function
DM=@(xta)(xta>=0&xta<0.5).*(8.*xta-4); %% Define the differential equation of first order
DDM=@(xta)(xta>=0&xta<0.5).*(8); %% Define the differential equation of second order
N=@(eta)(eta>=0&eta<0.5).*(((0.5-eta)./0.5).*((0.5-eta)./0.5)); %% Define another piecewise function
DN=@(eta)(eta>=0&eta<0.5).*(8.*eta-4); %% Define the differential equation of first order
DDN=@(eta)(eta>=0&eta<0.5).*(8); %% Define the differential equation of second order
f1=@(xta,eta)DM(xta).*N(eta); %%%product a new piecewise function based on previous piecewise functions
f2=@(xta,eta)M(xta).*DN(eta); %%%product a new piecewise function based on previous piecewise functions
%%%%%Caculte the matrix Bm
Bm=[(f1(xta,eta))*df1'*e1,(f1(xta,eta))*df1'*e2,(f1(xta,eta))*df1'*e3;
(f2(xta,eta))*df2'*e1,(f2(xta,eta))*df2'*e2,(f2(xta,eta))*df2'*e3;
((f2(xta,eta))*df1'+(f1(xta,eta))*df2')*e1,((f2(xta,eta))*df1'+(f1(xta,eta))*df2')*e2,((f2(xta,eta))*df1'+(f1(xta,eta))*df2')*e3];
%%%%%%%%%%%%%%%%%
%%%%%Caculte the matrix Bb
T=[0;0;1];
g1=@(xta,eta)DDM(xta).*N(eta);
g2=@(xta,eta)M(xta).*DDN(eta);
g3=@(xta,eta)DM(xta).*DN(eta);
Bb=-[(g1(xta,eta))*T'*e1,(g1(xta,eta))*T'*e2,(g1(xta,eta))*T'*e3;
(g2(xta,eta))*T'*e1,(g2(xta,eta))*T'*e2,(g2(xta,eta))*T'*e3;
2*(g3(xta,eta))*T'*e1,2*(g3(xta,eta))*T'*e2,2*(g3(xta,eta))*T'*e3];
%%%%%%%%%%%%%%%%%
K0=(h.*Bm'*D.*Bm+(h*h*h/12)*Bb'*D.*Bb);
K=integral2(@(xta,eta)K0,0,1,0,1) %%%calculte the intergration of K0
%%% In theory,the matrix K should be a constant matrix after the integraion
Accepted Answer
More Answers (0)
Categories
Find more on Symbolic Math Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!