Clear Filters
Clear Filters

integration using two variables

2 views (last 30 days)
Ramneet Sidhu
Ramneet Sidhu on 25 Oct 2019
Answered: Walter Roberson on 25 Oct 2019
I have two expressions for variables a and x
M = (-150 + 20.556*x - ((1/2)*(x-10)^2 - (1/60)*(x-10)^3))*heaviside(20-x) + (5.556*x+(250/3))*heaviside(x-20);
m = (a*(1-x/30))*heaviside(20-a) + (x*(1-a/30)*heaviside(20-x) + a*(1-x/30)*heaviside(x-20))*heaviside(a-20);
And another expression
Mm = M*m;
I want to integrate Mm with respect to x treating a as a constant from x = 0 to x = 30. How can i do it?

Answers (1)

Walter Roberson
Walter Roberson on 25 Oct 2019
Use the symbolic toolbox
syms x a
M = (-150 + 20.556*x - ((1/2)*(x-10)^2 - (1/60)*(x-10)^3))*heaviside(20-x) + (5.556*x+(250/3))*heaviside(x-20);
m = (a*(1-x/30))*heaviside(20-a) + (x*(1-a/30)*heaviside(20-x) + a*(1-x/30)*heaviside(x-20))*heaviside(a-20);
Mm = M*m;
result = simplify( int(expand(Mm), x, 0, 30) );

Community Treasure Hunt

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

Start Hunting!