Solve Numeric Expressions in MATLAB

In summary, the person is asking for help in obtaining the numerical value of certain expressions in MATLAB. They mention that in Mathematica they would use the command N[expression] and are looking for a similar function in MATLAB. Two possible solutions suggested are using the eval() function or the num2str() function.
  • #1
quin
50
0
dear friends
when I run my code in MATLAB , some expressions like:
"8763559185889905/20769187434139310514121985316880384"
appear in my result, so if I want MATLAB to give the numerical value of these sentences, what shouls I type?
for example in mathematica I know that I must write : N[expression]
thanks
 
Physics news on Phys.org
  • #2
quin said:
dear friends
when I run my code in MATLAB , some expressions like:
"8763559185889905/20769187434139310514121985316880384"
appear in my result, so if I want MATLAB to give the numerical value of these sentences, what shouls I type?
for example in mathematica I know that I must write : N[expression]
thanks

Try these:
http://www.mathworks.com/help/matlab/ref/eval.html
 

Related to Solve Numeric Expressions in MATLAB

1. What is a numeric expression in MATLAB?

A numeric expression in MATLAB is a mathematical statement that consists of numbers, variables, and mathematical operators. It is used to perform calculations and solve mathematical problems in MATLAB.

2. How do I solve a numeric expression in MATLAB?

To solve a numeric expression in MATLAB, you can use the built-in function eval or the solve function. The eval function evaluates the expression and returns the result, while the solve function solves for a specific variable in the expression.

3. What are the different mathematical operators used in numeric expressions in MATLAB?

The different mathematical operators used in numeric expressions in MATLAB are addition (+), subtraction (-), multiplication (*), division (/), exponentiation (^), and parentheses (()) for grouping operations. These operators follow the standard order of operations in mathematics.

4. Can I solve complex numeric expressions in MATLAB?

Yes, you can solve complex numeric expressions in MATLAB. MATLAB has built-in functions for working with complex numbers, such as real and imag to extract the real and imaginary parts of a complex number, and abs and angle to calculate the magnitude and angle of a complex number.

5. Are there any shortcuts for solving numeric expressions in MATLAB?

Yes, there are some shortcuts for solving numeric expressions in MATLAB. You can use the ans variable to store the result of the previous calculation and use it in the next calculation. You can also use the sym function to create symbolic expressions and solve them symbolically with the solve function.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
10
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
763
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
Back
Top