MATLAB Answers

Solving three simultaneous equations for analytical solution

1 view (last 30 days)
Teck Lim
Teck Lim on 16 Mar 2020
Commented: Teck Lim on 16 Mar 2020
Hi there,
I am trying to solve for k_t+1, tau_t, l^t-1_2 in terms all other parameters that are taken to be given. You can assume that w(h_t)=exp(bh_t). I have tried executing this code:
syms k2 k1 R B s h a l2 l1 t1 t2 b d
I am getting the error message Indexing with parentheses '()' must appear as the last operation of a valid indexing expression.
What should I change in the code to run it properly?


Sign in to comment.

Accepted Answer

Stephan on 16 Mar 2020
Keep it short and simple + use "*" for multiplication operations:
syms k2 k1 Rk1 R BR s h a l2 l1 t1 t2 bh d
eq(1) = k2==(BR*(exp(bh)*(1-l2-a)-t1)-t2)/(BR+R);
eq(2) = t1==(d*(exp(bh)*(1-l2-a)-k2)-Rk1)/(1+d);
eq(3) = l2==(s*(exp(bh)*(1-a)-k2-t1))/(exp(bh)+s*exp(bh));
vars = [k2, t1, l2]
Im not sure what you want to do with this code, because the solution for k2, t1 and l2 are already there in the equations.


Show 1 older comment
Teck Lim
Teck Lim on 16 Mar 2020
I tried the code and it works out fine. Thanks!
Now that I have solved for k2,t1 and l2 in terms of parameters, I want to solve for E and F in the following equation by subbing in the optimal k2, t1, and l2 that I just found on the right hand side.
Does this seem like something that can be coded on MATLAB?

Sign in to comment.

More Answers (0)