1. Solve function
① Numerical solution of single equation
syms x;
x0 = double(solve(x +2 – exp(x),x));
Find the solution of X + 2 = exp (x), and the result is shown in double
In use, you can also write x + 2 = = exp (x), note that ‘= =’
In addition, if there are multiple solutions, the function returns only one solution
② Solving the equation with signed variables
syms x a b c;
x0 = solve(a*x^2+b*x+c,x);
Two solutions can be obtained
③ Solving equations
syms x y z;
e1 = 2*x – y +z;
e2 = x + y – 6;
e3 = z^2 +2*y;
[x0,y0,z0] = solve(e1,e2,e3,x,y,z);
double([x0,y0,z0])
Can return multiple solutions, note that can not directly solve double conversion
2. Vpasolve function
Only one solution can be returned to solve the equation in a certain range
syms x;
double(vpasolve(x +2 – exp(x),x,[-2,2]))
The solution near a point can also be obtained
double(vpasolve(x +2 – exp(x),x,1))
The premise is that this’ nearby point ‘cannot deviate too much from the solution
To find out all the solutions, we can first draw a graph and find out the approximate interval or adjacent points of each solution
Read More:
- Python’s direct method for solving linear equations (5) — square root method for solving linear equations
- How to Solve differential equations with MATLAB
- How to use matlab to solve equation
- Matlab draw logarithmic coordinates!
- Matlab realization of user-defined curve and legend
- Matlab — looking for peak function
- The usage of Matlab function downsample
- Debugging mode of MATLAB: dbstop if error
- Countermeasures for Error 1935 when installing MATLAB under Windows 10
- How to wrap a long string in MATLAB
- What are the common clearing commands in MATLAB?
- Matlab: Three forms of random number generated (Rand, Randi and Randn)
- Matlab 2018a cracked the licensing error: – 8523
- Matlab prompt error
- Matlab: successfully solve too many input arguments
- How to use matlab xlswrite
- Matlab shows license manager error – 103
- Solve CONDA’s “solving environment: failed” problem
- Matlab matrix transpose function
- Matlab im show squeeze