- #1
ra_forever8
- 129
- 0
I am trying to solve 3 non-linear system of 3 variables using the Newton-raphson method in matlab. Here are the three equations:
\begin{equation} c[\alpha I+ k_f+k_d+k_ns+k_p(1-q)]-I \alpha =0 \end{equation}
\begin{equation} s[\lambda_b c P_C +\lambda_r (1-q)]- \lambda_b c P_C =0 \end{equation}
\begin{equation} q[\gamma +c k_p \frac{P_C}{P_Q}]- c k_p \frac{P_C}{P_Q}=0 \end{equation}
Solve the above systems of equation to get the values for $c,s$ and $q$? $tolerence= 10^{-4}$. initail values:$ (c_0,s_0,q_0)=0$.
The values for the parameters are:
$I=1200, k_f= 6.7*10^{7}, k_d= 6.03*10^8, k_n=2.92*10^9, k_p=4.94*10^9, \lambda_b= 0.0087, \lambda_r =835, \gamma =2.74, \alpha =1.14437*10^-3, P_C= 3*10^{11}, P_Q= 2.87*10^{10}$=>
This is what I think to do in matlab, but i don't know how to start the code in matlab. I have define the function for 3 systems of equation.\begin{equation} f(c,s,q)=> c[\alpha I+ k_f+k_d+k_ns+k_p(1-q)]-I \alpha =0 \end{equation}
\begin{equation} g(c,s,q)=>s[\lambda_b c P_C +\lambda_r (1-q)]- \lambda_b c P_C =0 \end{equation}
\begin{equation} h(c,s,q)=>q[\gamma +c k_p \frac{P_C}{P_Q}]- c k_p \frac{P_C}{P_Q}=0 \end{equation}now, i have to do partial derivatives of $f(c,s,q), g(c,s,q), h(c,s,q)$ in terms of $c, s, q$.Then set up the matrix $J$ and do the inverse matrix ($J^{-1}$). And apply the netwon iteration method, using $(c,s,q)= (c_0,s_0,q_0) - J^{-1} (f,g,h)$.I need to do some iterations until it converges to $tolerence= 10^{-4}$.Can please help me how to do in MATLAB with the MATLAB code. I am beginner in matlab.
\begin{equation} c[\alpha I+ k_f+k_d+k_ns+k_p(1-q)]-I \alpha =0 \end{equation}
\begin{equation} s[\lambda_b c P_C +\lambda_r (1-q)]- \lambda_b c P_C =0 \end{equation}
\begin{equation} q[\gamma +c k_p \frac{P_C}{P_Q}]- c k_p \frac{P_C}{P_Q}=0 \end{equation}
Solve the above systems of equation to get the values for $c,s$ and $q$? $tolerence= 10^{-4}$. initail values:$ (c_0,s_0,q_0)=0$.
The values for the parameters are:
$I=1200, k_f= 6.7*10^{7}, k_d= 6.03*10^8, k_n=2.92*10^9, k_p=4.94*10^9, \lambda_b= 0.0087, \lambda_r =835, \gamma =2.74, \alpha =1.14437*10^-3, P_C= 3*10^{11}, P_Q= 2.87*10^{10}$=>
This is what I think to do in matlab, but i don't know how to start the code in matlab. I have define the function for 3 systems of equation.\begin{equation} f(c,s,q)=> c[\alpha I+ k_f+k_d+k_ns+k_p(1-q)]-I \alpha =0 \end{equation}
\begin{equation} g(c,s,q)=>s[\lambda_b c P_C +\lambda_r (1-q)]- \lambda_b c P_C =0 \end{equation}
\begin{equation} h(c,s,q)=>q[\gamma +c k_p \frac{P_C}{P_Q}]- c k_p \frac{P_C}{P_Q}=0 \end{equation}now, i have to do partial derivatives of $f(c,s,q), g(c,s,q), h(c,s,q)$ in terms of $c, s, q$.Then set up the matrix $J$ and do the inverse matrix ($J^{-1}$). And apply the netwon iteration method, using $(c,s,q)= (c_0,s_0,q_0) - J^{-1} (f,g,h)$.I need to do some iterations until it converges to $tolerence= 10^{-4}$.Can please help me how to do in MATLAB with the MATLAB code. I am beginner in matlab.