現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
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));
>>
madhan ravi
2018 年 10 月 24 日
編集済み: madhan ravi
2018 年 10 月 24 日
whats x,y ,s and z ? provide the values
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 日
編集済み: madhan ravi
2018 年 10 月 24 日
B_matrix=(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 月 24 日
編集済み: madhan ravi
2018 年 10 月 24 日
whats your desired result and its size ?
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!エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の 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 (한국어)
