Not enough input arguments in Matlab R2021b
1 view (last 30 days)
Show older comments
function [K] = assembly_gl(Ke,gdl_bar,K)
%--Function that assembles the global stiffness matrix for the entire structure
%Ke=Enter the name of the finite element stiffness matrix you want to add
%gdl_bar=Vector containing the degrees of freedom of the finite element
%K=Specify the array in which the assembly will be stored
for igdl=1:4
ifila = gdl_bar(igdl);
for jgdl=1:4
jcolumna = gdl_bar(jgdl);
K(ifila,jcolumna) = K(ifila,jcolumna) + Ke(igdl,jgdl);
end
end
end
%I don't understand why the error comes out: Not enough input arguments.
%I have already entered all the arguments
%Please help me, thank you so much
2 Comments
Accepted Answer
VBBV
on 24 Jul 2022
Ke = randi(4,4); % assume this as FE stiffness matrix to be added
gdl_bar = [2 2 4 4]; % no of DOF for each element in stiffness
K = zeros(size(Ke)); % pre-allocate matrix to store assembly
K = assembly_gl(Ke,gdl_bar,K) % resulting assembled matrix you want
function [K] = assembly_gl(Ke,gdl_bar,K)
%--Function that assembles the global stiffness matrix for the entire structure
%Ke=Enter the name of the finite element stiffness matrix you want to add
%gdl_bar=Vector containing the degrees of freedom of the finite element
%K=Specify the array in which the assembly will be stored
for igdl=1:4
ifila = gdl_bar(igdl);
for jgdl=1:4
jcolumna = gdl_bar(jgdl);
K(ifila,jcolumna) = K(ifila,jcolumna) + Ke(igdl,jgdl);
end
end
end
give input matrix parameters to the function and pre-allocate any matrix used as argument in function
3 Comments
More Answers (0)
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!