필터 지우기
필터 지우기

Substituting a syms variable with another syms variable equation

조회 수: 1 (최근 30일)
Philosophaie
Philosophaie 2013년 6월 29일
Error code:
??? Subscript indices must either be real positive integers or logicals.
Error in ==> EigenValuesVectors4x4ToTensorFactor at 10
f=sym(zeros(4,4,4))
Code:
syms T11 T12 T13 T14 T21 T22 T23 T24 T31 T32 T33 T34 T41 T42 T43 T44
f=sym(zeros(4,4,4))
%MatLab does not like the substitution of a syms variable with another syms variable equation. Is there any way around this?
%h(i,k) is a 4x4 matrix with syms formula in each cell
ta13=solve(h(1,3),'T14')
ta14=solve(h(1,4),'T14')
tb11=subs(h(1,1),'T14',ta14)
tb12=subs(h(1,2),'T14',ta14)
  댓글 수: 1
Walter Roberson
Walter Roberson 2013년 6월 29일
Is it possible that you had code before that which creates a variable with the name "sym" ?
which sym

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

답변 (2개)

Philosophaie
Philosophaie 2013년 6월 29일
No the "sym" in "f=sym(zeros(4,4,4))" creates "f" as a symbolic zero matrix.
  댓글 수: 1
Walter Roberson
Walter Roberson 2013년 6월 29일
It cannot both create "f" as a symbolic matrix and complain about a subscript.
Your posted error message refers to line 10, but the "f=" line it is complaining about is at most line 3. What is before that in the code ?

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


Walter Roberson
Walter Roberson 2013년 6월 30일
Please post the result of
which sym
class(sym) %might generate error message
Also, what does
sym('abc')
return?

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by