Matlab freezes when using a piecewise function integration

Hello , I need to integrate a function with unknown argument x,y,z. My code is this:
fx = piecewise(-1.5<x<-0.5, x^2/2+3*x/2+9/8, -0.5<x<0.5, -x^2+3/4, 0.5<x<1.5, x^2/2 -3*x/2+9/8);
fy = piecewise(-1.5<y<-0.5, y^2/2+3*y/2+9/8, -0.5<y<0.5, -y^2+3/4, 0.5<y<1.5, y^2/2 -3*y/2+9/8);
fz = piecewise(-1.5<z<-0.5, z^2/2+3*z/2+9/8, -0.5<z<0.5, -z^2+3/4, 0.5<z<1.5, z^2/2 -3*z/2+9/8);
res = fx*fy*fz;
int(res,x,-1.5,1.5);
but it freezes matlab. How can I integrate this function? Thank you.

Risposte (1)

I'm guessing you're encountering the problem described in this Answer. If so, update your MATLAB installation as described in the Answer.

1 Commento

Thank you for responding I checked the link and updated my MATLAB but It still didn't work. I think the piecewise function has some problem if it multiplied 3 syms and try integrate it.
int(res,x,-1.5,-0.5)
int(res,x,-1.5,-0.4)
first one work but the other doesn't.

Accedi per commentare.

Richiesto:

il 9 Lug 2018

Commentato:

il 10 Lug 2018

Community Treasure Hunt

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

Start Hunting!

Translated by