MATLAB: system of equations (HELP)

In summary, the conversation discusses the need for help in solving a system of equations involving trigonometric functions in MATLAB. The user suggests writing a function to input the equations and boundary values, solve the equations, and return the values within the specified range.
  • #1
ilvreth
33
0
Hi to all. I have to say at first that i have no idea on MATLAB at all. I want some help.
I want to solve a system of equation for example

Code:
(0.02315352 - 0.0576` Cos[\[Theta]] + 0.01152 Cos[\[Theta]]^3) Cos[\[Phi]] - 0.01152 Cos[\[Theta]] Cos[\[Phi]]^3 Sin[\[Theta]]^2 - 0.001919 Cos[\[Theta]] Sin[\[Phi]] =0

-0.02315352 Sin[\[Phi]] - 0.01152 Cos[\[Theta]]^3 Sin[\[Phi]] + Cos[\[Theta]] (0.00191 Cos[\[Phi]] + 0.0576 Sin[\[Phi]] + 0.01152 Sin[\[Theta]]^2 Sin[\[Phi]]^3) =0

with

Code:
0 <= \[Phi] <= 2 \[Pi]  
 0 <= \[Theta] <= \[Pi]

How the MATLAB code could be written to solve this system numerically?
 
Physics news on Phys.org
  • #2
You can easily write a function for that. Take the equation and the boundary values as input, solve the equation, check which values are within the range, and return them. Simple.
 

FAQ: MATLAB: system of equations (HELP)

1. What is a system of equations in MATLAB?

A system of equations in MATLAB is a set of equations that are solved simultaneously to find the values of multiple variables. It is represented as a matrix with the coefficients of the equations and a vector with the constants.

2. How do I create a system of equations in MATLAB?

To create a system of equations in MATLAB, you can use the "syms" command to define the variables, then create a matrix with the coefficients and a vector with the constants. Alternatively, you can input the equations directly into the "solve" function.

3. How do I solve a system of equations in MATLAB?

To solve a system of equations in MATLAB, you can use the "solve" function and specify the variables and equations as inputs. Alternatively, you can use the "linsolve" function to solve linear systems or the "fsolve" function for non-linear systems.

4. What if my system of equations has no solution or infinite solutions in MATLAB?

If your system of equations has no solution, MATLAB will return an empty matrix as the solution. If your system of equations has infinite solutions, MATLAB will return a symbolic solution with parameters.

5. Can I plot the solution to a system of equations in MATLAB?

Yes, you can use the "plot" function to plot the solution to a system of equations in MATLAB. If your system has more than two equations, you can use the "ezplot" function to plot the solution in 3D.

Similar threads

Replies
1
Views
742
Replies
1
Views
2K
Replies
5
Views
2K
Replies
7
Views
2K
Replies
2
Views
1K
Replies
4
Views
1K
Replies
10
Views
3K
Replies
3
Views
2K
Back
Top