Hi! can someone kindly help me out with this code?
t = 1;
b = 10;
h = 5;
Bmat = @(x,y) (1./(4.*b.*h)).*[-(h-y), 0, (h-y), 0, (h+y), 0, -(h+y), 0;0, -(b-x), 0, -(b+x), 0, (b+x), 0, (b-x);-(b-x), -(h-y), -(b+x), (h-y), (b+x), (h+y), (b-x), -(h+y)];
Bmat_T = @(x,y) (1./(4.*b.*h)).*[-(h-y), 0, -(b-x);0, -(b-x), -(h-y);(h-y), 0, -(b+x);0, -(b+x), (h-y);(h+y), 0, (b+x);0, (b+x), (h+y);-(h+y), 0, (b-x);0, (b-x), -(h+y)];
v = 0.3;
YoungM = 30.*10.^6;
Dmat = (YoungM./(1-v.^2))*[1 v 0;v 1 0;0 0 ((1-v)./2)]
Kmat = integral2(@(x,y)(Bmat_T(x,y).*Dmat.*Bmat(x,y).*t), -b, b, -h, h)
This is the error I get...
Error using horzcat
Dimensions of arrays being concatenated are not consistent.
Error in
HW6_P4>@(x,y)(1./(4.*b.*h)).*[-(h-y),0,-(b-x);0,-(b-x),-(h-y);(h-y),0,-(b+x);0,-(b+x),(h-y);(h+y),0,(b+x);0,(b+x),(h+y);-(h+y),0,(b-x);0,(b-x),-(h+y)]
Error in HW6_P4>@(x,y)(Bmat_T(x,y).*Dmat.*Bmat(x,y).*t)
Error in integral2Calc>integral2t/tensor (line 228)
Z = FUN(X,Y); NFE = NFE + 1;
Error in integral2Calc>integral2t (line 55)
[Qsub,esub] = tensor(thetaL,thetaR,phiB,phiT);
Error in integral2Calc (line 9)
[q,errbnd] = integral2t(fun,xmin,xmax,ymin,ymax,optionstruct);
Error in integral2 (line 106)
Q = integral2Calc(fun,xmin,xmax,yminfun,ymaxfun,opstruct);
Error in HW6_P4 (line 19)
Kmat = integral2(@(x,y)(Bmat_T(x,y).*Dmat.*Bmat(x,y).*t), -b, b, -h, h)

 Réponse acceptée

Ameer Hamza
Ameer Hamza le 15 Avr 2020

1 vote

Since you are trying to integrate a matrix equation. You will need to make two calls to integral() with ArrayValued option enabled
Kmat = integral(@(x) integral(@(y) (Bmat_T(x,y)*Dmat*Bmat(x,y).*t), -h, h, 'ArrayValued', 1), -b, b, 'ArrayValued', 1);

2 commentaires

Mujahid Sirika
Mujahid Sirika le 15 Avr 2020
Thank you so much for helping me out Mr. Hamza and also for doing so so quickly.
Ameer Hamza
Ameer Hamza le 15 Avr 2020
I am glad to be of help.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Symbolic Math Toolbox dans Centre d'aide et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by