Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Symbolic objects

Status
Not open for further replies.

musilj

Electrical
Joined
Oct 8, 2006
Messages
16
Location
AU
Hi all,
How can I create a matrix of symbolic objects like
A=[a1,a2,a3,a4.........a60] using possibly an index

such as i=1:60 if possible .

Again is it possible to mix symbolic objects and numeric decimals in one matrix, such as
A=[a1,a2,a3,4,5,6,a4....]

cheers
musilj

 
A=[sym('a1'),sym('a2'),sym('a3'),4,5,6,sym('a4')....]

=====================================
Eng-tips forums: The best place on the web for engineering discussions.
 
How can I create a matrix of symbolic objects like
A=[a1,a2,a3,a4.........a60] using possibly an index
Code:
for i=1:60 
A(i)=sym(strcat('a',num2str(i)))
end
Again is it possible to mix symbolic objects and numeric decimals in one matrix, such as
A=[a1,a2,a3,4,5,6,a4....]
Code:
A=[sym('a1'),sym('a2'),sym('a3'),4,5,6,sym('a4')....]

=====================================
Eng-tips forums: The best place on the web for engineering discussions.
 
hi electricpete

A quick paste into matlab of your code with the index resulted in the following error.

??? The following error occurred converting from sym to double:
Error using ==> sym.double at 25
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 ==> trial at 5
A(i)=sym(strcat('a',num2str(i)));

cheers
 
Hmmm. Works for me. Try executing clear before you run it.

Otherwise there must be a difference in the behavior of matlab on our machines. I have an old version Matlab 5.2

=====================================
Eng-tips forums: The best place on the web for engineering discussions.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top