Systems equation with a loop
9 views (last 30 days)
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!
Dhananjay Kumar on 5 Dec 2019
See these two examples:
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).