Systems equation with a loop

4 views (last 30 days)
Ivana Vujkovic Bukvin
Ivana Vujkovic Bukvin on 2 Dec 2019
Answered: Dhananjay Kumar on 5 Dec 2019
Hi,
I'm quite new to MATLAB, doing research in biophysics and trying to solve a system of two complex equations for some NMR work. I simplified them in the screenshots. M and D have a range of values, t, K, a, b are constants and x and r are the variables. I need to solve the equations for r, that's my end point.
I want to import M and D values as matrices and I started working on writting the script for the loops. I'm having a bigger problem with solving the equatings and I would appreciate any help to get me started, I don't expect anyone to write me a script, I just need a bit of help. Thank you!Picture 1.png

Answers (1)

Dhananjay Kumar
Dhananjay Kumar on 5 Dec 2019
Hey,
See these two examples:
  1. Solve System of Equations with vpasolve
  2. Root of Function with fzero
If the value of a parameter is unavailable, then you can use solve function with syms variables, which will give you solution in terms of the parameters. See this example: in.mathworks.com/help/symbolic/examples/solve-equations-in-returnconditions-mode.html#responsive_offcanvas . This method is really cool but might not work with complex equations. In that case MATLAB gives you solutions using the above mentioned vpasolve function.
This example uses Symbolic Math Toolbox, which solves equations symbolicaly (the same way we differentiate/integrate functions on our notebooks to get derivative/integral function in terms of variables).

Categories

Find more on Symbolic Math Toolbox in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!