×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Are you an
Engineering professional?
Join Eng-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• 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.

# question

## question

(OP)
I apologize for this stupid question. I am by no means a whiz at MATLAB like those of you on this thread. I fumble thru it and after using the help documentation, I will usually get things to work out. But this time I am having no luck. I have created a script and it works just fine. It calculates the correct answer every time. The problem is that the answer is displayed with "alot" of digits (a whole number) in the numerator and "alot" of digits (another whole number) in the denominator. It appears as though is wants to provide me the answer as a rational number. Can something be done to change this answer to something more "convenient"?

### RE: question

Are you doing something in the symbolic toolbox?

Get hold of the numerator, float it, ditto denominator, divide one by the other. use whos to check your data types, i expect they are currently int32.

Cheers

Greg Locock

New here? Try reading these, they might help FAQ731-376: Eng-Tips.com Forum Policies http://eng-tips.com/market.cfm?

### RE: question

(OP)
Thanks to both of you for taking the time to respond. The enclosed file is from whos. You can see that there are symbols and double variables. As I said in the previous post, the script kicks out the correct answer every time I use it with different variables, but it is displayed like this:

I1 =
765579986917712557162455387676757216362297431867076221475784577824413513977414677006199684411213333331405708899715649333325089375*w00^2)/5949503719112237390567237772294939358455642146678530973561839157469652121126802112426702893957437563628320908225210224738304
+
388505692027172886012134637830510594533891171686402955435619038358513667741636109828196480582119123127999956781721252082528717154149307180539400149802561324081218178783535*w00*w02)/120766797594289323271729746591624604509341479053326093708038601607859973196548763266756055205685080561326988000984443036792658708157593364241965896045846273396780650463232
+
590987384944035213478982883660499250847905383779439912647190361066239052187049718131701916610166590093456901248443311183944474602988196042066240822390115953505787241395277879521350174108776267888925061*w00*w11)/2508228255056559327717299405517639477515382672702395372151508761915556027554073725754578846110147691358081325939263447624692646145908262187541873345685902047135936580242368983360130194608842238078734041088
+
174827569426090409885298372444891464654962343042130332930150353940817659379606939392857334097927698681480532980427819676976840747612780277066023604711310753137386275236880975*w00*w20)/34780837707155325102258167018387886098690345967357914987915117263063672280606043820825743899237303201662172544283519594596285707949386888901686178061203726738272827333410816

which is obviously ridiculous. How can I get it to display something like this:

I1 = 128679.64*w00^2 + 3.21*w00*w02 + .000231*w00*w11 + 5.03*w00*w20

### RE: question

(OP)
Thank you Greg. Thanks a lot.
'problem solved

### RE: question

(OP)
Here's another question. Maybe you guys could possibly help me. Solving a system of linear equations in Matlab is obviously a basic maneuver. I other words, if I had equation#1 as 2x+4y=3 and equation#2 as 6x+4y=5, I would obviously go to the command window and type something like A=[2 4;6 4] and B=[3;5]. Then I could obviously get the answers for x and y by inv(A)*B.
But my question is this: Deep within my Matlab script, a system of linear equations that has 9 equations and 9 unknowns is eventually produced. Once the unknowns are calculated, they are subsequently used as my script continues on with further calculations. I don’t want to have to go to the command window and manually create matrices in order to obtain the unknowns like in the example I gave. Is there a technique that can be used to separate the equation coefficients from the equation symbols and create a matrix from them?

### RE: question

(OP)
I’ll try to be more clear with my last question.
What if I had a symbolic equation defined as:
V=1a+2b+3c+4d+5e+6f+7g+8h+9i
Is there a command or technique that I could use to extract the coefficients and create a 9x9 matrix without going to the command window?

#### 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.

#### Resources

Research Report - How Engineers are Using Remote Access
Remote access enables engineers to work from anywhere provided they have an internet connection. We surveyed our audience of engineers, designers and product managers to learn how they use remote access within their organizations. We wanted to know which industries have adopted remote access, which software they are using, and what features matter most. Download Now
eBook - Managing the Context of Product Complexity Using the Digital Twin
Keeping track of changes to complex products is difficultâ€”think Aerospace & Defense equipment, new generations of commercial aircraft, and software-based automobiles. A new way to managing the digital context of the physical product is required and the answer is the Digital Twin. This ebook explores the opportunity available for Operations and Maintenance for the Digital Twin. Download Now
White Paper - Trends in Industrial Filtration
Substantial progress has been made in filtration technologies in recent years. New filter media materials, designs and processes have led to filters that are more efficient, reliable, compact and longer lasting. This white paper will discuss the various trends that are impacting operational responsibilities of MROs today and the resources that are available for staying up-to-date on the latest filtration solutions. Download Now

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:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!