Clear Filters
Clear Filters

Issue with Matlab symbolic int

2 views (last 30 days)
I am modeling a load curve distribution on a cantilever beam in order to get a maximum deflection value and for whatever reason, the moment equation which should just be the boundary condition + the integral of the shear function is evaluating at a higher number at the connection point than it should. I have found a way to account for this but now do not know the validity of the integration in general. I am wondering how I may have messed up my own code to get the erroneous result.
code attached here
syms y
load=vpa(0.5*(2.97952*(2.56-2/15*1.54*y)+sqrt((16*4/(3*pi))^2*(1-y^2/(15/2)^2))))
%load curve using up as negative from convention
L=7.5; %length of beam in ft
totalf=int(load, [0, 7.5]); %total force as a check
yloc=int(load*y, [0, 7.5])/totalf; %find the centroid of load
V=-40+int(load); %shear as function of span using convention, V(0)=-40 is the first boundary condition
shearcheck=int(V);
y=0;
shearcorrection=subs(shearcheck); %factor that accounts for weird evaluation of int(V)
M=totalf*yloc+int(V)-shearcorrection; %moment as a function of span using convention, M(0)=127 is second bc
momentcheck=int(M);
matroot=subs(momentcheck);
EItheta=int(M); %first integral of the deflection eqn
EIdeflection=int(EItheta); %deflection
EImaxdeflection=int(EItheta,[0 7.5]); %deflection

Accepted Answer

Walter Roberson
Walter Roberson on 13 Nov 2023
Use definite integrals rather than indefinite integrals.
For example matlab tends to take a term that would be typically be written as sin(x)^2, and return cos(x)^2 instead and in the indefinite integral that is valid because the two different by a constant.
  1 Comment
Nathan Lang
Nathan Lang on 13 Nov 2023
Okay thank you for the suggestion I will try that.

Sign in to comment.

More Answers (0)

Categories

Find more on Symbolic Math Toolbox in Help Center and File Exchange

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!