How to numerically evaluate an integral that has symbols in it?
Show older comments
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);
Accepted Answer
More Answers (0)
Categories
Find more on Calculus in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!