MATLAB: How to numerically evaluate an integral that has symbols in it

MATLABnumerical integration

I have an integral that cannot be evaluated symbolically. When I try to do it numerically I want to keep some symbols in the result (to have an output like 10*x1+0.5*x3 where x1 and x3 are symbols) because in a further step I want to build a system of two equations that will solve for x1 and x3. How should I do it? Thanks
for i=1:length(A(1,:))
x3=sym('x3(t)');
x1=sym('x1(t)');
x1_diff=diff(diff(x1,t),t);
r=D_o-thickness;
fI1=symfun((x3*sqrt(r^2+(z-zG)^2))/(- (3*x3^5)/40 - x3^3/6 - x3 + pi/2+atan(r/(z-zG))),[t z]);
fI1_diff=diff(diff(fI1,t),t);
fI1_diff_z=@(z)(fI1_diff);
% balast maybe need to revisit if integration doesn't work --> add x1
% and x3 as variables besides z
fI1_t=@(z) (density2.*A(2,i)*(x1_diff-fI1_diff));
% steel cyl
fI1_t2=@(z) (ro_steel.*A(1,i)*(x1_diff-fI1_diff));
% deck
fI1_t3=@(z) (ro_steel.*(A(1,i)+A(2,i))*(x1_diff-fI1_diff));
% added mass
fI1_t4=@(z)(density.*(A(1,i)+A(2,i))*(x1_diff-fI1_diff));
% keep x1 and x3 intact
FI1(1,i)=integral(fI1_t,-hw,hb-hw)+integral(fI1_t2,-hw,hc-hw)+integral(fI1_t3,hc-hw-hd/2,hc-hw+hd/2)+integral(fI1_t4,-hw,0);

Best Answer

You cannot do that. integral() requires purely numeric values to work with.
You will need to convert the integral to an approximation such as by using taylor or series representation.