Unrecognized function or variable 'length' ???
Afficher commentaires plus anciens
Hello, I'm working on a program, in which I need to measure the length of arrays;
But whenever I use length(var), it prompts 'unrecognized function or variable 'length'' (Line 3).
I thought length() was a built-in variable...
By the way, typing in length(1:20) in the command line works (outputs 20.)
How come it does not work in my codes?? Someone please help!
function w = KUFSolve(K,u,f)
U = [(1:length(u))' u];
F = [(1:length(f))' f];
Uk = [];
F1 = [];
Uu = [];
F2 = [];
for i = 1 : length(U)
if ~isnan(U(i,2))
Uk(size(Uk,1)+1,:) = [U(i,1) U(i,2)];
F1(size(F1,1)+1,:) = [F(i,1) 0];
else
Uu(size(Uu,1)+1,:) = [U(i,1) 0];
F2(size(F2,1)+1,:) = [F(i,1) F(i,2)];
end
end
Unew = cat(1,Uk,Uu);
Fnew = cat(1,F1,F2);
length(Uu) = len1;
length(Unew) = len2;
T = eye(length(U));
Tnew = zeros(length(U));
for i = 1 : length(U)
Tnew(i,:) = T(Unew(i,1),:);
end
T = Tnew;
Kt = T * K * T';
ut = Unew(:,2);
ft = Fnew(:,2);
K11 = Kt(1:len1, 1:len1);
K12 = Kt(1:len1, len1+1:len2);
K21 = Kt(len1+1:len2, 1:len1);
K22 = Kt(len1+1:len2, len1+1:len2);
uk = ut(1:len1);
fk = ft(len1+1:len2);
uu = K22\( fk - K21*uk ); %剛性方程式
fu = K11*uk +K12*uu;
u = T' * [uk; uu];
f = T' * [fu; fk];
R = {u,f};
w = R;
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur MATLAB dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
