MATLAB: How to find double integral in Matlab to the following code

double integralsymbolic

I have the following code, I have a problem to solve it, please i need help
syms s t
a=0.1;b=0.4;
Rs=-log(s);
Ws=vpa([int(log(s)*log(s)*Rs,s,a,b), -int(log(s)*Rs,s,a,b), -2*int(log(s)*cos(2*pi*s)*Rs,s,a,b); ...
-int(log(s)*Rs,s,a,b), int(Rs,s,a,b), 2*int(cos(2*pi*s)*Rs,s,a,b); ...
-2*int(log(s)*cos(2*pi*s)*Rs,s,a,b), 2*int(cos(2*pi*s)*Rs,s,a,b), 4*int(cos(2*pi*s)*cos(2*pi*s)*Rs,s,a,b)]);
W11=inv(Ws);
w1 = W11(:,1);
g(s)=[-log(s);1;2*cos(2*pi*s)];
g(t)=[-log(t);1;2*cos(2*pi*t)];
Gs=((w1)'*g(s));
Gt=((w1)'*g(t));
fin = @(s,t) Gs.*Gt.*Rs.*Rt.*(min(1-s,1-t)-((1-s).*(1-t)));
MM=integral2(fin,0.1,0.4,0.1,0.4)
The problem in the min(1-s,1-t)-((1-s).*(1-t))
Thank you in advance

Best Answer

syms s t v
Q = @(v) sym(v);
a = Q(0.1);
b = Q(0.4);
Rs = -log(s);
Rt = -log(t);
Pi = Q(pi);
Int = @vpaintegral;
Ws = ([Int(log(s)*log(s)*Rs,s,a,b), -Int(log(s)*Rs,s,a,b), -2*Int(log(s)*cos(2*Pi*s)*Rs,s,a,b); ...
-Int(log(s)*Rs,s,a,b), Int(Rs,s,a,b), 2*Int(cos(2*Pi*s)*Rs,s,a,b); ...
-2*Int(log(s)*cos(2*Pi*s)*Rs,s,a,b), 2*Int(cos(2*Pi*s)*Rs,s,a,b), 4*Int(cos(2*Pi*s)*cos(2*Pi*s)*Rs,s,a,b)]);
W11 = inv(Ws);
w1 = W11(:,1);
g(v) = [-log(v);1;2*cos(2*Pi*v)];
Gs=((w1)'*g(s));
Gt=((w1)'*g(t));
Min = @(a,b) piecewise(a<=b, a, b);
fin = Gs.*Gt.*Rs.*Rt.*(Min(1-s,1-t)-((1-s).*(1-t)));
MM = Int(Int(fin,s,Q(0.1),Q(0.4)),t,Q(0.1),Q(0.4));
disp(MM)
Your Gs and Gt are separable and could be calculated independently if not for the (Min(1-s,1-t)-((1-s).*(1-t))) part .