MATLAB Answers

AH2019
0

Convert integrand to a function in a loop

Asked by AH2019
on 15 Apr 2019
Latest activity Answered by madhan ravi
on 15 Apr 2019
Please consider following code.
syms r
f= sym('f',[1,5]);
ANS = zeros(1,5);
for q=1:5
f(q) = sin(r^q)/r
ANS(q) = integral(f(q) ,pi/2 ,pi ,'ArrayValued' , 1)
end
Please hint me to convert integrand to function handle.
In general, f is a too large expression rather than "sin(r^q)/r".
Thank you taking your time

  2 Comments

If you mean converting symfun to function handle , you may be interested in matlabFunction(). [comment moved to answer]
Thanks ravi

Sign in to comment.

Products

1 Answer