Solving smbolic equation in matlab

  • MATLAB
  • Thread starter quin
  • Start date
  • Tags
    Matlab
So in the future, please post your code along with your question.In summary, the user is asking for help with solving an equation where one side is a number and the other side is an expression in terms of "m". They are encountering an error in MATLAB when trying to solve the equation and want to know how to check for values of "m" that make both sides of the equation equal. They are seeking advice on what to add to their code to accomplish this.
  • #1
quin
50
0
dear users
I must do a lot of calculation and after that,I arrive to an equation in which one side is a number (forexample 330) and the other side of equation is expression in terms of "m"
I want to solve the equation for "m"
But when I ren my cide in MATLAB it gives error that a symbolic parameter cannot sum with nember and...
So I want to give different values of m (in a special Interval) in a numerical way and each time, it chek whether for that special "m" both sides of equation become equal or not,and when it finds that "m" that converg both sides of equation, it shows that m.
so haw can I do it? what should I add to my code?
thanks
 
Physics news on Phys.org
  • #2
As a general rule, posting code is much easier than describing code.
 

1. How do I solve a symbolic equation in Matlab?

To solve a symbolic equation in Matlab, you can use the solve function. This function takes in two arguments: the symbolic equation and the variable to solve for. For example, to solve the equation x^2 + 3x + 2 = 0 for x, you would use the syntax solve('x^2 + 3x + 2 = 0', 'x').

2. Can I solve multiple equations at once in Matlab?

Yes, you can solve multiple equations at once in Matlab by using the solve function with an array of equations and an array of variables. For example, if you have the equations x + y = 3 and 2x - y = 0, you can solve for x and y using the syntax solve([x + y = 3, 2x - y = 0], [x, y]).

3. How can I simplify the solution of a symbolic equation in Matlab?

To simplify the solution of a symbolic equation in Matlab, you can use the simplify function. This function takes in an expression and simplifies it by combining like terms and performing basic algebraic operations. For example, simplify(2x + 4x) would return 6x.

4. Is it possible to solve systems of nonlinear equations in Matlab?

Yes, Matlab has the ability to solve systems of nonlinear equations using the fsolve function. This function takes in an array of equations and an array of variables and iteratively solves for the values that make all of the equations equal to zero. It is important to provide initial guesses for the values of the variables in order for the function to converge to a solution.

5. Can I plot the solution of a symbolic equation in Matlab?

Yes, you can plot the solution of a symbolic equation in Matlab by using the ezplot function. This function takes in an equation and plots it over a specified range of values for the variable. For example, ezplot('x^2 + 3x + 2', [-5, 5]) would plot the equation x^2 + 3x + 2 from x = -5 to x = 5. You can also use ezplot to plot the solution of a system of equations by using the syntax ezplot([x + y = 3, 2x - y = 0], [-5, 5]).

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
10
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
1K
  • Advanced Physics Homework Help
Replies
1
Views
951
Back
Top