How do you integrate a constant?

theta and miu are constants
theta = 0.01305
miu = 0.0546
const = @(x) tan(theta + miu)
r = integral(constant,0,1)

1 Comment

The integral of a constant function is the size of the rectangle between the curve and the X axis: const * (1 - 0).

Sign in to comment.

 Accepted Answer

Joshua
Joshua on 29 Jun 2017
Edited: Torsten on 21 Nov 2022
theta = 0.01305
theta = 0.0131
miu = 0.0546
miu = 0.0546
const = @(x) tan(theta + miu)+0*x
const = function_handle with value:
@(x)tan(theta+miu)+0*x
r = integral(const,0,1)
r = 0.0678

2 Comments

I am doing this and it is telling me that the integral is an error.
Don't forget the +0*x when integrating your constant function.
Or use
theta = 0.01305
theta = 0.0131
miu = 0.0546
miu = 0.0546
const = @(x) tan(theta + miu)
const = function_handle with value:
@(x)tan(theta+miu)
r = integral(const,0,1,'ArrayValued',true)
r = 0.0678

Sign in to comment.

More Answers (0)

Asked:

on 29 Jun 2017

Edited:

on 21 Nov 2022

Community Treasure Hunt

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

Start Hunting!