how can solve vpa function problem?

12 views (last 30 days)
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);

Accepted Answer

Walter Roberson
Walter Roberson on 14 May 2016
Ke = sym(zeros(6,6,ne));
Kg = sym(zeros(150,150,1));
  2 Comments
M Sameel Hanif
M Sameel Hanif on 14 May 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 on 14 May 2016
This is difficult for us to debug without knowing what the sample inputs are.

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!