이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
I am writing an FEM code in matlab. I want to make the sizes of repmat(N_dash, 3, 1) and repelem(ey.', 3, 1) the exact same. Original size of repmat(N_dash, 3, 1) is 3x3 and that of repelem(ey.', 3, 1) is 9x1. Any help will be much appreciated.
조회 수: 1 (최근 30일)
이전 댓글 표시
for epsilon3=-1:1:1
N_dash(1)=-0.5+epsilon3;
N_dash(2)=-2*epsilon3;
N_dash(3)=0.5+epsilon3;
end
ly=(x(5)-x(2)); (x,y,z are constants like 0.9876,0.8876..etc)
my=(y(5)-y(2));
ny=(z(5)-z(2));
lve=sqrt(((ly)^2)+((my)^2)+((ny)^2)); %%vertical length of element
ey = [ly; my; ny] / lve;
A=repmat(N_dash, 3, 1) .* repelem(ey.', 3, 1)
댓글 수: 1
채택된 답변
madhan ravi
2018년 10월 24일
편집: madhan ravi
2018년 10월 24일
a=repelem(ey.', 3, 1)
a= reshape(a,3,3) %and then multiply a with repmat
A=repmat(N_dash, 3, 1) .* a
댓글 수: 26
Virajan Verma
2018년 10월 24일
Still getting the same error, though i have used size and numel command and sizes and no. of elements are same. I dont know what is the problem. The LHS of eqaution is B_matrix(1,1:8) which is defined as:
for i=1:8
for j=1:26
B_matrix(i,j)=0;
end
end
Virajan Verma
2018년 10월 24일
%%Strain for the (Axial) Extensional Flexural Effects
for epsilon3=-1:1:1
N_dash(1)=-0.5+epsilon3;
N_dash(2)=-2*epsilon3;
N_dash(3)=0.5+epsilon3;
end
(TAKE ANY CONSTANT VALUE OF x,y,z like 0.8798,0.3456)
%%Tangent vector (ey) about y dirsction
ly=(x(5)-x(2));
my=(y(5)-y(2));
ny=(z(5)-z(2));
lve=sqrt(((ly)^2)+((my)^2)+((ny)^2)); %%vertical length of element
ey = [ly; my; ny] / lve;
for i=1:8
for j=1:26
B_matrix(i,j)=0;
A=reshape(repmat(ey, 3, 1),3,3)
for i=1:8
B_matrix(1,1:8)=1/s*repmat(N_dash, 3, 1) .* A
end
end
end
madhan ravi
2018년 10월 24일
>> COMMUNITY
Undefined function or variable 'y'.
Error in COMMUNITY (line 9)
my=(y(5)-y(2));
>>
Virajan Verma
2018년 10월 24일
I have a separate input file for that. U can take any decimal values like 0.9821,0.8736 etc
madhan ravi
2018년 10월 24일
for epsilon3=-1:1:1
N_dash(1)=-0.5+epsilon3;
N_dash(2)=-2*epsilon3;
N_dash(3)=0.5+epsilon3;
end
% (TAKE ANY CONSTANT VALUE OF x,y,z like 0.8798,0.3456)
%%Tangent vector (ey) about y dirsction
ly=2-5;
my=7+18;
ny=4;
lve=sqrt(((ly)^2)+((my)^2)+((ny)^2)); %%vertical length of element
ey = [ly; my; ny] / lve;
for i=1:8
for j=1:26
B_matrix(i,j)=0;
A=reshape(repmat(ey, 3, 1),3,3)
B_matrix=1/4*repmat(N_dash, 3, 1) .* A
end
end
madhan ravi
2018년 10월 24일
It works I made slight modification also I assumed value of s as 4(if it matters)
Virajan Verma
2018년 10월 24일
편집: Walter Roberson
2018년 10월 24일
x1=0
y1=0
z1=0
x2=0.5
y2=0
z2=0.049406182
x3=1
y3=0
z3=0.097122055
x5=0.5
y5=0.51
z5=0.049406182
for i=-1:1:1
epsilon3=(i)
lx=(epsilon3-0.5)*x(1)-(2*epsilon3)*x(2)+(epsilon3+0.5)*x(3);
mx=(epsilon3-0.5)*y(1)-(2*epsilon3)*y(2)+(epsilon3+0.5)*y(3);
nx=(epsilon3-0.5)*z(1)-(2*epsilon3)*z(2)+(epsilon3+0.5)*z(3);
%%Jacobian Factor
s=sqrt(((lx)^2)+(((mx)^2)+(((nx)^2))));
madhan ravi
2018년 10월 24일
편집: madhan ravi
2018년 10월 24일
x(1)=0
y(1)=0
z(1)=0
x(2)=0.5
y(2)=0
z(2)=0.049406182
x(3)=1
y(3)=0
z(3)=0.097122055
x(5)=0.5
y(5)=0.51
z(5)=0.049406182
epsilon3=-1:1:1
for i=1:numel(epsilon3)
lx(i)=(epsilon3(i)-0.5)*x(1)-(2*epsilon3(i))*x(2)+(epsilon3(i)+0.5)*x(3);
mx(i)=(epsilon3(i)-0.5)*y(1)-(2*epsilon3(i))*y(2)+(epsilon3(i)+0.5)*y(3);
nx(i)=(epsilon3(i)-0.5)*z(1)-(2*epsilon3(i))*z(2)+(epsilon3(i)+0.5)*z(3);
end
%%Jacobian Factor
s=0.5025;
% (TAKE ANY CONSTANT VALUE OF x,y,z like 0.8798,0.3456)
%%Tangent vector (ey) about y dirsction
lve=sqrt(((ly)^2)+((my)^2)+((ny)^2)); %%vertical length of element
ey = [ly; my; ny] / lve;
for i=1:8
for j=1:26
B_matrix(i,j)=0;
A=reshape(repmat(ey, 3, 1),3,3)
B_matrix=(1/s)*repmat(N_dash, 3, 1) .* A
end
end
Virajan Verma
2018년 10월 24일
But i am getting this error: Subscripted assignment dimension mismatch.
Error in practisee2 (line 225) B_matrix(1,1:9)=1/s*repmat(N_dash, 3, 1) .* A
madhan ravi
2018년 10월 24일
replace
B_matrix(1,1:9)=(1/s)*repmat(N_dash, 3, 1) .* A
with
B_matrix=(1/s)*repmat(N_dash, 3, 1) .* A
madhan ravi
2018년 10월 24일
if you got the answer for your question accept the answer so people know the question is solved
Virajan Verma
2018년 10월 24일
I have not got the desired result yet, otherwise i would have done that.
madhan ravi
2018년 10월 25일
편집: madhan ravi
2018년 10월 25일
Really really glad that I was able to help because you were struggling for days with this problem.
Virajan Verma
2018년 10월 25일
Yes i was really struggling. Its people like u who support others. Really thanks for ur valuable suggestions and time.
추가 답변 (0개)
참고 항목
태그
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
아시아 태평양
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)
