How can I update initial guess for Newtons algorithm inside a ODE45 function for the next step?
이전 댓글 표시
I need to solve 5 differential equations, but first I need to solve a nonlinear equation with Newton's algorithm to find some of the variables used on ODEs. Here is my function; I am not writing the whole code, its long and complicated, but I guess this will help you to understand my solution.
______________________________________________________________________________________________ function dxdf = retentatepurityC2(f,x,r,qA, qB, qC, qD, qE)
%defining the tolerance for Newtons Algorithm t=10e-15;
%initial value of yPa (this is what I want to update in the next step by using the value from previous step.) yPa=....
% the loop for Newton's Algorithm The loop calculates the value of yPa for given x(1), x(2), x(3) and x(4). After yPa is calculated the variables used in ODEs below are calculated (like y1, y2 ...etc)
%solving differential equations
there are five diff. equations dependent on y1, y2 ...etc. dxdf(1,1)= dxdf(2,1)= dxdf(3,1)= dxdf(4,1)= dxdf(5,1)=
end
When the calculations end for a time step, ODe starts from the beginning and uses the yPa that is defined for the very first step. I need to update yPa.
________________________________________________________________________________________
I need to update the initial value of yPa for the next f increment in the code. If I dont do it, the Newtons algorithm does not converge since the initial value is not good. How can i update my initial guess for Newton's Algorithm (yPa(n)) in the code for the next increment. The next yPa should be equal to y1 from previous step.
Thanks, Merve
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Numeric Solvers에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!