필터 지우기
필터 지우기

I want matlab to read my input data(txt file)

조회 수: 2 (최근 30일)
Jisu Yang
Jisu Yang 2019년 6월 3일
댓글: KSSV 2019년 6월 4일
캡처.PNGthis is my input data
I want matlab to read my input data in the beginning of the code.
If i run this code, comes out;
Undefined function or variable 'gettrussdata2D'.
Error in Trussd (line 2)
[nodes,elems,C,A,bcs,loads] = gettrussdata2D(filename);
filename = uigetfile('*.txt','Select the input file');
[nodes,elems,C,A,bcs,loads] = gettrussdata2D(filename);
Nel = size(elems,1);
Nnodes = size(nodes,1);
alldofs = 1:2*nodeNumber;
K = zeros(2*nodeNumber);
u = zeros(2*nodeNumber,1);
f = zeros(2*nodeNumber,1);
dofspec = [];
for ii = 1:size(bcs,1)
thisdof = 2*(bcs(ii,1)-1)+bcs(ii,2);
dofspec = [dofspec thisdof];
u(thisdof) = bcs(ii,3);
end
doffree = alldofs;
doffree(dofspec) = [];
for ii = 1:size(loads,1)
f(2*(loads(ii,1)-1)+loads(ii,2)) = loads(ii,3);
end
for iel = 1:Nel
elnodes = elems(iel,1:2);
nodexy = nodes(elnodes, :);
[Kel] = TrussElement2D(nodexy,C(iel),A(iel));
eldofs = 2*(elnods(1)-1)+1:2*(elnodes(1)-1)+2;
eldofs = [dleofs 2*(elnodes(2)-1)+1:2*(elnodes(2)-1)+2];
K(eldofs,eldofs) = K(eldofs,eldofs) +Kel;
end
u(doffree) = K(doffree,doffree)\(f(doffree)-K(doffree,dofspec)*u(dofspec));
f(dofspec) = K(dofspec,:)*u;
format long
disp(['Displacement vector:']);u
disp(['Forcevector:']);f
  댓글 수: 2
Rik
Rik 2019년 6월 3일
And here is a classmate who also forgot to explain where the gettrussdata2D function should be comming from. It isn't part of Matlab, nor are there any other results on Google. The TrussElement2D is also a mystery.
Have a read here. It will greatly improve your chances of getting an answer.
KSSV
KSSV 2019년 6월 4일
Attach your file ...not a image. Tell us wht you want to extract from there.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Web Services에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by