Not enough input arguments in Matlab R2021b
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Pedro Rodriguez
il 24 Lug 2022
Commentato: Pedro Rodriguez
il 24 Lug 2022
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 Commenti
Risposta accettata
VBBV
il 24 Lug 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 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Logical in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!