Hi! I am using function handles to integrate with several variables (note: I made the same program using symbolic integration, but it takes a really long time). However, I keep getting an error in matrix dimensions in the last line of my when I plug in R(1) and I really can't figure out what is wrong. Any tips would be greatly appreciated!
FUN_1 = @(y_1,y_2,x_1,x_2)sum(heaviside(y_1-1)).*dirac(1,y_2-1).*(-1/2*log((x_1-y_1).^2+(x_2-y_2).^2))+sum(dirac(y_1-1).*dirac(y_2-1)); Q_1 = @(x_1,x_2)integral2(@(y_1,y_2)FUN_1(y_1,y_2,x_1,x_2),1,2,1,2);FUN_2 = @(y_1,y_2,x_1,x_2)sum(heaviside(y_1-1).*dirac(1,y_2-1))+sum(dirac(y_1-1).*dirac(y_2-1))*(-1/2*log((x_1-y_1).^2+(x_2-y_2).^2));Q_2 = @(x_1,x_2)integral2(@(y_1,y_2)FUN_1(y_1,y_2,x_1,x_2),1,2,1,2);S = @(x_1,x_2)Q_1(x_1,x_2)+Q_2(x_1,x_2);R = @(x_2)integral(@(x_1)S(x_1,x_2),1,2);b = R(1);disp(b)
Best Answer