MATLAB solver, calling on pre-defined variables within the equations -
So I'm wondering how to input the pre-defined variables in the equations themselves.
Here's the code.
function [A, B, C] = A_B_C_problem_generalized (lambda_1, lambda_2, mu_1, mu_2, gamma_1, gamma_2) Clear clc syms a1 a2 a4b1b2b4 c1 c2c4 [A1, A2, A4, B1, B2, B4, C1, C2, C4] = ... solution ('a1 + a4 = lambda_1 + lambda_2' ... 'a1 * a4 - a2 ^ 2 = lambda_1 * lambda_2 ', ... ..' B1 + B4 = mu_1 + mu_2 ', ...' B1 * b4 - b2 ^ 2 = mu_1 * mu_2 ', ...' c1 + c4 = 'Gamma_1 + gamma_2', ... 'c1 * c4 - c2 ^ 2 = gam_1 * gam_2', ... 'c1 = a1 + b1', ... 'c2 = a2 + b2', ... ' C4 = a4 + b4 '); ... How can I go about doing this? The number of lambda's, mu k, and gamma is expected to be added to you.
After
Ah, the right approach was not to use the wire instead, instead it was converted to a problem of finding roots. , Which the solver himself does, if you take everything on one side of the equation ... B2, b4, c1, c2, c4] = ... solution (a1 + a4 - (lambda_1 + lambda_2), ... a1 * a4 - a2 ^ 2 - (lambda_1 * lambda_2), ... b1 + b 4 - (mu_1 + mu_2), ... b1 * b4 - b2 ^ 2 - (mu_1 * mu_2), ... c1 + c4 - (gamma_1 + gamma_2), ... c1 * c4 - c2 ^ 2 - (Gamma_1 * gamma_2), ... C1 - A1 - B1, ... c2 - A2 - b2, c 4 ... - A4 - B4) is the way to go
Comments
Post a Comment