×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Symbolic objects

Symbolic objects

Symbolic objects

(OP)
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

 

RE: Symbolic objects

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

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

RE: Symbolic objects

Quote:

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

Quote:

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.

RE: Symbolic objects

(OP)
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

RE: Symbolic objects

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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login



News


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close