Info

This question is closed. Reopen it to edit or answer.

Solve functions symbolically, and getting answers as functions, solve() fsolve()

1 view (last 30 days)
Hello
This is my humble piece of code, solving a system of three linear equations to get all C_xy_0.
syms x y z
eqns = [(1-J11(J11_0))*x-J12(J12_0)*y == (J11(J11_0)*C1)/N_1 , (1-J22(J22_0))*z-J21(J21_0)*y == (J22(J22_0)*C2)/N_2 , (2-(J11(J11_0)+J22(J22_0)))*y == J12(J12_0)*(x+C2/N_2) + J21(J21_0)*(z+C1/N_1)];
result = solve(eqn);
C_11_0 = result.x;
C_12_0 = result.y;
C_21_0 = C_12_0;
C_22_0 = result.z;
Trying desperatly to find a way to get the solution as functions of the function "Jxy()", or as a function of the parameter "Jxy_0", such as C_xy_0 ( Jxy(Jxy_0) ) .
For example, something sort of like
C_11_0 = @(J11_0) result.x(J11(J11_0))
C_12_0 = @(J12_0) result.y(J12(J12_0))
.
.
Thanks a lot in advance!
Uri

Answers (1)

Matt J
Matt J on 5 May 2020
Edited: Matt J on 5 May 2020
C_11_0 = matlabFunction( result.x ) ;
C_12_0 = matlabFunction( result.y ) ;

Products

Community Treasure Hunt

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

Start Hunting!