Info

# it is not working.

1 view (last 30 days)
Chaudhary P Patel on 25 Jan 2020
Closed: MATLAB Answer Bot on 20 Aug 2021
%%%%%%%%%%%%%% acceleration matrix %%%%%%%%%%%%%%
for g=1:1:10
for i=1:ne
Ecc=eval(['Ee',num2str(i)]);
if (i<166)&&(i>420)
ug=[0.3*Ug(g,2);Ug(g,2);0;Ecc*Ug(g,2);0.3*Ug(g,2);Ug(g,2);0;Ecc*Ug(g,2)];
if (i>165)&&(i<421)
ug=[Ug(g,2);0.3*Ug(g,2);0;Ecc*Ug(g,2);Ug(g,2);0.3*Ug(g,2);0;Ecc*Ug(g,2)];
eval(['f',num2str(i),'=MGf.ug']);
t=eval(['T',num2str(i)]);
ff=eval(['f',num2str(i),'l']);%Calling local acceleration matrix
eval(['f',num2str(i),'g','=transpose(t).*ff.*t']);%Evaluation acceleration matrix in global coordinate system
end
end
end
end
##### 2 CommentsShowHide 1 older comment
John D'Errico on 25 Jan 2020
@pramod kumar:
Please learn to use comments instead of answers if you are not providing an answer. Answer movect to a comment:

Chaudhary P Patel on 27 Jan 2020
sir i correct it but now i am getting difficulties in assembling the global force vector, please giive me some clue.
Stephen23 on 27 Jan 2020
Edited: Stephen23 on 27 Jan 2020
"...tell me one thing how to assemble the global force vector."
Write the code without eval.
Once you do that, then you can trivially use indexing to allocate to your "global force vector" (and also use all of the standard, inbuilt code helping tools to help debug your code). For as long as you use eval like that, your code will be slow, complex, buggy, hard to debug, and will continue to waste your time.

### Community Treasure Hunt

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

Start Hunting!

Translated by