integration using two variables

1 次查看(过去 30 天)
Ramneet Sidhu
Ramneet Sidhu 2019-10-25
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?

回答(1 个)

Walter Roberson
Walter Roberson 2019-10-25
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) );

类别

Help CenterFile Exchange 中查找有关 Symbolic Math Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by