how to simplify symbolic expressions

3 views (last 30 days)
rakesh kumar
rakesh kumar on 12 Jan 2022
Commented: rakesh kumar on 12 Jan 2022
how can i simplify the given expession .i am getting this result when I am using symbolic math
(4.2e-41*((0.46*(1.3*(7.5e+123*(-1.0*EI^12)^(1/2) + 3.6e+124*EI^6)^(2/3) + 2.6e+42*EI^2*(7.5e+123*(-1.0*EI^12)^(1/2)
  2 Comments
KSSV
KSSV on 12 Jan 2022
Edited: KSSV on 12 Jan 2022
Show us the full code. Read about the function simplify.
rakesh kumar
rakesh kumar on 12 Jan 2022
syms EI w
nel=2; % number of elements
nnel=2; % number of nodes per element
ndof=2; % number of dofs per node
nnode=(nnel-1)*nel+1; % total number of nodes in system
sdof=nnode*ndof; % total system dofs
% elastic modulus
%xi=1; % moment of inertia of cross-section
tleng=1; % length of a half of the beam
leng=tleng/nel; % element length of equal size
area=1; % cross-sectional area of the beam
rho=1; % mass density (arbitrary value for this problem because
% it is not used for the static problem)
ipt=1; % option for mass matrix (arbitrary value and not used here)
bcdof(1)=1; % first dof (deflection at left end) is constrained
bcval(1)=0; % whose described value is 0
bcdof(2)=2; % 12th dof (slope at the symmetric end) is constrained
bcval(2)=0; % whose described value is 0
displacement=zeros(sdof/2,1);
ff=zeros(sdof,1); % initialization of system force vector
kk=sym(zeros(sdof,sdof)); % initialization of system matrix
index=zeros(nnel*ndof,1); % initialization of index vector
ff(2*nel+1)=-1; % because a half of the load is applied due to symmetry
mm=zeros(sdof,sdof);
force=zeros(sdof, 1);
for iel=1:nel % loop for the total number of elements
edof = nnel*ndof;
start = (iel-1)*(nnel-1)*ndof;
%
for i=1:edof
index(i)=start+i;
end
c=EI/(leng^3);
k=c*[12 6*leng -12 6*leng; 6*leng 4*leng^2 -6*leng 2*leng^2; -12 -6*leng 12 -6*leng;6*leng 2*leng^2 -6*leng 4*leng^2];
edof = length (index);
for i=1:edof
ii=index(i) ;
for j=1:edof
jj=index(j) ;
kk(ii,jj)=kk(ii,jj)+k(i,j);
end
end
if ipt==1
%
c2=rho*area*leng/420 ;
m=c2*[156 22*leng 54 -13*leng;...
22*leng 4*leng^2 13*leng -3*leng^2;...
54 13*leng 156 -22*leng;...
-13*leng -3*leng^2 -22*leng 4*leng^2];
%
% lumped mass matrix
%
elseif ipt==2
m=zeros(4,4);
mass=rho*area*leng;
m=diag([mass/2 0 mass/2 0]);
%
% diagonal mass matrix
%
else
%
m=zeros(4,4);
mass=rho*area*leng;
m=mass*diag([l/2 leng^2/78 1/2 leng^2/78]);
%
end
edof = length (index)
for i=1:edof
ii=index(i) ;
for j=1:edof
jj=index(j) ;
mm(ii,jj)=mm(ii,jj)+m(i,j);
end
end
n=length(bcdof);
sdof=size(kk);
for i=1:n
c=bcdof(i);
for j=1:sdof
kk(c,j)=0;
kk(j,c)=0;
mm(c,j)=0;
mm(j,c)=0;
end
%
mm(c,c)=1;
end
end
% solve the matrix equation and print
% w^2 M * X = K*X
% w^2*X = Minv * K * X
%(Minv*K – w^2*I)X = 0
%This is in the same standard eigenvalue form as above with
%A = Minv*K
%Lambda = w^2
A=(inv(mm)*kk)
A1=sym(A)
[V D]=eig(A1);
a=simplify(V)
b=simplify(D)
a1=vpa(a,2)
b1=vpa(b,2)

Sign in to comment.

Answers (1)

KSSV
KSSV on 12 Jan 2022
pretty(vpa(b1(3,3),8))
It looks that equation has lot of numbers and fractional powers of EI. FEw numbers are very small and few are very big. You need to check your calculations. Looks like this is an FEM problem. Why you want to use syms in the first place? Rethink on your problem.
  1 Comment
rakesh kumar
rakesh kumar on 12 Jan 2022
i want to find the eigen vectors of two noded beam. i want to verify that eigen vectors are independent of EI .For one node I have got the result. Also I wnat to use it to check wether eigen vectors are dependent on EI if we use different values of EI in the two element.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!