Borrar filtros
Borrar filtros

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

3 visualizaciones (últimos 30 días)
Jisu Yang
Jisu Yang el 3 de Jun. de 2019
Comentada: KSSV el 4 de Jun. de 2019
캡처.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 comentarios
Rik
Rik el 3 de Jun. de 2019
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 el 4 de Jun. de 2019
Attach your file ...not a image. Tell us wht you want to extract from there.

Iniciar sesión para comentar.

Respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by