how can solve vpa function problem?

12 vues (au cours des 30 derniers jours)
M Sameel Hanif
M Sameel Hanif le 14 Mai 2016
Commenté : Walter Roberson le 14 Mai 2016
ne=input('Number of elements ');
Ke=zeros(6,6,ne);
Kg=zeros(150,150,1);
for i=1:1:ne
L1=input('please enter starting length ');
L2=input('ending length ');
A1=input('A1 ')
A2=input('A2 ')
n=input('Beam Type- 1 for Circular 2 for Square ')
n1=input('Please enter starting node ');
n2=input('Please enter ending node ');
nen=[(3*(n1))-2 (3*(n1))-1 (3*(n1)) (3*(n2))-2 (3*(n2))-1 (3*(n2))];
theta=input('angle ')
[K]=kfunc(A1,A2,n,theta,L1,L2);
Ke(:,:,i)=K(:,:,1);
for j=1:1:6
for k=1:1:6
Kg(nen(j,k),nen(j,k),1)=Ke(j,k,i);
end
end
end
display(Kg)
i get the error
The following error occurred converting from sym to double: Error using mupadmex Error in MuPAD command: DOUBLE cannot convert the input expression into a double array.
If the input expression contains a symbolic variable, use the VPA function instead.
Error in Main (line 15) Ke(:,:,i)=K(:,:,1);

Réponse acceptée

Walter Roberson
Walter Roberson le 14 Mai 2016
Ke = sym(zeros(6,6,ne));
Kg = sym(zeros(150,150,1));
  2 commentaires
M Sameel Hanif
M Sameel Hanif le 14 Mai 2016
still getting an error
Index exceeds matrix dimensions.
Error in Main (line 18) Kg(nen(j,k),nen(j,k),1)=Ke(j,k,i);
Walter Roberson
Walter Roberson le 14 Mai 2016
This is difficult for us to debug without knowing what the sample inputs are.

Connectez-vous pour commenter.

Plus de réponses (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by