Calculation of a precise point after indefinite integral

2 views (last 30 days)
Hello,
I am trying to calculate the indefinite integral q_o_a to then calculate at the point of d = pi/2 (q_1). I have tried with function handles and a script function as well but I can't work out how to do this. It gives me the good indefinite integral such that q_o_a = 3200cos(d) * Sy/IXX (second half unimportant) but I can't managed to use this as I would like to.
Thanks for any help
  4 Comments
Thomas Beaudet
Thomas Beaudet on 23 Feb 2021
Hi, sorry for the confusion, R, Sy, IXX and t are all constants and have been defined earlier. The only variation is d, from pi/2 to pi and I would like to evaluate the precise q_1 for pi.
Star Strider
Star Strider on 23 Feb 2021
If you want to vary ‘d’, that will require a loop (or arrayfun, however that is significantly slower than an explicit loop, so I rarely use it), for example with all the constants already in your workspace:
y_a = @(d,R) R*sin(d) ;
dv = linspace(pi/2, pi, 10);
for k = 1:numel(dv)
q_o_a(k) = -(Sy/IXX)*integral(@(d)y_a(d,R)*R*t,0,dv(k)) ;
end
Note also that there must be two limits-of-integration if you want to evaluate any integral, regardless of the function used to integrate it.

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 23 Feb 2021
syms Sy IXX
syms d R
y_a = @(d,R) R*sin(d) ;
q_o_a(d, R) = -(Sy/IXX)*int(y_a(d,R)*R*t,d) ;
q_1 = q_o_a(pi/2, R) ;
Reminder that definite integrals require the subtraction of the value at the lower bound. If you are using 0 as the lower bound then the indefinite integral is non-zero there.
  1 Comment
Walter Roberson
Walter Roberson on 23 Feb 2021
syms Sy IXX
syms d R t
y_a = @(d,R) R*sin(d) ;
q_o_a(d, R) = -(Sy/IXX)*int(y_a(d,R)*R*t,d) ;
D = linspace(pi/2, pi, 10);
q_1 = q_o_a(D, R) ;
q_1.'
ans = 

Sign in to comment.

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!