matlab end补全,新手matlab简要问题:系统提示要加end

[/size][/backcolor][/color][color=#999999][size=12px]function[RESULT]=assignment2pointstrainstress(u,v)load FE_result.mat

E = 1e8;nu = 0.3;b=(12/nelx)/2;  h=(60/nely)/2;

E11=E/(1-nu^2);E22=E/(1-nu^2);E33=0.5*E/(1+nu);E12=nu*E/(1-nu^2);E21=nu*E/(1-nu^2);

E31=0; E32=0; E13=0; E23=0;

E=[E11 E12 E13;

E21 E22 E23;

E31 E32 E33];

% For left lower corner

x=-b;y=-h;

B=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) (h+x) -(h+y)];

u1=( (u-1)*(nely+1)+v )*2-1;  v1=( (u-1)*(nely+1)+v )*2;

u2=( u*(nely+1)+v )*2-1;  v2=( u*(nely+1)+v )*2;

u3=( u*(nely+1)+v )*2-3;  v3=(u-1*(nely+1)+v )*2-2;

u4=( (u-1)*(nely+1)+v )*2-3;  v4=( (u-1)*(nely+1)+v )*2-2;

d=[u1;v1;u2;v2;u3;v3;u4;v4]; e=B*d;  S=E*e

exx1=e(1);   eyy1=e(2); exy1=e(3); sxx1=S(1); syy1=S(2);sxy1=S(3);

% For right upper corner

x=b;y=h;

B=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) (h+x) -(h+y)];

u1=( (u-2)*(nely+1)+v )*2+1;  v1=( (u-2)*(nely+1)+v )*2+1;

u2=( (u-1)*(nely+1)+v )*2+1;  v2=( (u-1)*(nely+1)+v )*2+2;

u3=( (u-1)*(nely+1)+v )*2-1;  v3=( (u-1)*(nely+1)+v )*2;

u4=( (u-2)*(nely+1)+v )*2-1;  v4=( (u-2)*(nely+1)+v )*2;

d=[u1;v1;u2;v2;u3;v3;u4;v4]; e=B*d; S=E*e

exx2=e(1);   eyy2=e(2); exy2=e(3); sxx2=S(1); syy2=S(2); sxy2=S(3);

% For right lower corner

x=b;y=-h;

B=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) (h+x) -(h+y)];

u1=( (u-2)*(nely+1)+v )*2-1;  v1=( (u-2)*(nely+1)+v )*2;

u2=( (u-1)*(nely+1)+v )*2-1;  v2=( (u-1)*(nely+1)+v )*2;

u3=( (u-1)*(nely+1)+v )*2-3;  v3=( (u-1)*(nely+1)+v )*2-2;

u4=( (u-2)*(nely+1)+v )*2-3;  v4=( (u-2)*(nely+1)+v )*2-2;

d=[u1;v1;u2;v2;u3;v3;u4;v4];e=B*d;S=E*e;

exx3=e(1);eyy3=e(2);exy3=e(3);sxx3=S(1);syy3=S(2);sxy3=S(3);

%LEFT UPPER

x=-b;y=h;

B=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) (h+x) -(h+y)];

u1=( (u-1)*(nely+1)+v )*2+1;  v1=( (u-1)*(nely+1)+v )*2+2;

u2=( u*(nely+1)+v )*2+1;  v2=( u*(nely+1)+v )*2+2;

u3=( u*(nely+1)+v )*2-1;  v3=( u*(nely+1)+v )*2;

u4=( (u-1)*(nely+1)+v )*2-1;  v4=( (u-1)*(nely+1)+v )*2;

d=[u1;v1;u2;v2;u3;v3;u4;v4]; e=B*d;S=E*e;

exx4=e(1);   eyy4=e(2); exy4=e(3); sxx4=S(1);syy4=S(2); sxy4=S(3);

if nelx>u>1 && 1

a= exx4 ;a1=sxx4;

b= eyy4 ;b1=syy4;

c= exy4 ;c1=sxy4;

leftupper=[a b c  a1 b1 c1]

a= exx1 ;a1=sxx1;

b= eyy1 ;b1=syy1;

c= exy1 ;c1=sxy1;

leftlower=[a b c  a1 b1 c1]

a= exx2 ;a1=sxx2;

b= eyy2 ;b1=syy2;

c= exy2 ;c1=sxy2;

rightupper=[a b c a1 b1 c1]

a= exx3 ;a1=sxx3;

b= eyy3 ;b1=syy3;

c= exy3 ;c1=sxy3;

rightlower=[a b c a1 b1 c1]

if isequal(leftupper,leftlower, rightupper,rightlower)==0

disp('not equal');

else

disp('equal');

end

else if u==1 && v==1;

a= exx4 ;a1=sxx4;

b= eyy4 ;b1=syy4;

c= exy4 ;c1=sxy4;

disp(['The point have strain  xx: ', num2str(a), ' yy: ', num2str(b), ' xy: ', num2str(c)])

disp(['The point have stress  xx: ', num2str(a1), ' yy: ', num2str(b1), ' xy: ', num2str(c1)])

else if u==1 && v==nely+1;

a= exx1 ;a1=sxx1;

b= eyy1 ;b1=syy1;

c= exy1 ;c1=sxy1;

disp(['The point have strain  xx: ', num2str(a), ' yy: ', num2str(b), ' xy: ', num2str(c)])

disp(['The point have stress  xx: ', num2str(a1), ' yy: ', num2str(b1), ' xy: ', num2str(c1)])

else if u==nelx+1 && v==1;

a= exx2 ;a1=sxx2;

b= eyy2 ;b1=syy2;

c= exy2 ;c1=sxy2;

disp(['The point have strain  xx: ', num2str(a), ' yy: ', num2str(b), ' xy: ', num2str(c)])

disp(['The point have stress  xx: ', num2str(a1), ' yy: ', num2str(b1), ' xy: ', num2str(c1)])

else if u==nelx+1 && v==nely+1;

a= exx3 ;a1=sxx3;

b= eyy3 ;b1=syy3;

c= exy3 ;c1=sxy3;

disp(['The point have strain  xx: ', num2str(a), ' yy: ', num2str(b), ' xy: ', num2str(c)])

disp(['The point have stress  xx: ', num2str(a1), ' yy: ', num2str(b1), ' xy: ', num2str(c1)])

else if nelx+1>u>1 && v==1;

a= exx4 ;a1=sxx4;

b= eyy4 ;b1=syy4;

c= exy4 ;c1=sxy4;

leftupper=[a b c a1 b1 c1]

a= exx2 ;a1=sxx2;

b= eyy2 ;b1=syy2;

c= exy2 ;c1=sxy2;

rightupper=[a b c a1 b1 c1]

if isequal(leftupper, rightupper)==0

disp('not equal');

else

disp('equal');

end

else if nelx+1>u>1 && v==nely+1;

a= exx1 ;a1=sxx1;

b= eyy1 ;b1=syy1;

c= exy1 ;c1=sxy1;

leftlower=[a b c a1 b1 c1]

a= exx3 ;a1=sxx3;

b= eyy3 ;b1=syy3;

c= exy3 ;c1=sxy3;

rightlower=[a b c a1 b1 c1]

if isequal(leftlower, rightlower)==0

disp('not equal');

else

disp('equal');

end

else if u==nelx+1 && nely+1>v>1;

a= exx2 ;a1=sxx2;

b= eyy2 ;b1=syy2;

c= exy2 ;c1=sxy2;

rightupper=[a b c a1 b1 c1]

a= exx3 ;a1=sxx3;

b= eyy3 ;b1=syy3;

c= exy3 ;c1=sxy3;

rightlower=[a b c a1 b1 c1]

if isequal(rightupper,rightlower)==0

disp('not equal');

else

disp('equal');

end

else u==1 && nely+1>v>1;

a= exx4 ;a1=sxx4;

b= eyy4 ;b1=syy4;

c= exy4 ;c1=sxy4;

leftupper=[a b c  a1 b1 c1]

a= exx1 ;a1=sxx1;

b= eyy1 ;b1=syy1;

c= exy1 ;c1=sxy1;

leftlower=[a b c a1 b1 c1]

if isequal(leftupper,leftlower)==0

disp('not equal');

else

disp('equal');

end

end

end

[/size][/color][color=#999999][backcolor=rgb(242, 242, 242)][size=12px]

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值