how can solve vpa function problem?

조회 수: 12 (최근 30일)
M Sameel Hanif
M Sameel Hanif 2016년 5월 14일
댓글: Walter Roberson 2016년 5월 14일
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);

채택된 답변

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

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

태그

Community Treasure Hunt

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

Start Hunting!

Translated by