Azzera filtri
Azzera filtri

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

2 visualizzazioni (ultimi 30 giorni)
Jisu Yang
Jisu Yang il 3 Giu 2019
Commentato: KSSV il 4 Giu 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 Commenti
Rik
Rik il 3 Giu 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 il 4 Giu 2019
Attach your file ...not a image. Tell us wht you want to extract from there.

Accedi per commentare.

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by