This video contains the construction of shooting method code for second order nonlinear differential equation with ode45 and fzero command in MATLAB.
Пікірлер: 47
@samuelanderson81126 жыл бұрын
Thank you for this great example!
@Priya-hu7db2 жыл бұрын
In dy=zeros(2,1) what does it actually mean? I am not getting how (2, 1) are taken.Please tell.
@edholanda58973 жыл бұрын
Professor how would I solve this system of first order edos numerically by plotting the graph for the different values of (n). the derivatives are in relation to ha (r). a'/r = -e^2*v^2*(g^2 - 1) g' = - a*g/r given the boundary conditions a(0) = n a(inf)=0 g(0) = 0 g(inf)=1 where (e)=0.5 and (v)=1 are constant and n variavel. please give a helping hand there, I looked for and did not find any problems like this on the matlab website.
@8hng2 жыл бұрын
excellent... job well done.
@26goldnugge4 жыл бұрын
you really help me out.
@MechanicalCreativeContent4 жыл бұрын
Working program for all your reference function shooting_method clc clear all x=0.5; x1=fzero(@solver,x); end function F=solver(x) options = odeset('RelTol',1e-8,'AbsTol',[1e-8 1e-8]); [t,y]=ode45(@equation,[0 1],[1 x],options); s=length(t); F=y(s,1)-exp(1); figure(1) plot(t,y(:,1)) end function dy=equation(t,y) dy=zeros(2,1); dy(1)=y(2); dy(2)=t*exp(2*t)+y(1)-t*(y(2)^2); end
@Priya-hu7db2 жыл бұрын
when I tried this, error is coming. function shooting_method clc clear all x=0.5; x1=fzero(@solver,x); end error(function shooting_method Error: Function definitions are not permitted in this context.)
@sarveshboodoo32913 жыл бұрын
Hello, For the plot part, I tried to insert the analytical solution on the same graph. However, the output is only giving me the analytical solution and a flat horizontal line at x=0. How can I solve that? Thank you
@sanjeevsharma-tn3gq7 жыл бұрын
Thanks Dr. Rana.
@karimmosli8637 Жыл бұрын
Hello sir l have one problem with bvp4c function,i have written program for solving second order nolinear ode ,can you help me please
@95065959317 жыл бұрын
Hello Dr. Rana, I run your code and encountered with the following bunch of errors: ??? Input argument "x" is undefined. Error in ==> BVP>solver at 12 [t,u]=ode45(@equation, [0, 1], [1, x], options); Error in ==> BVP at 5 x1=fzero(solver,x); Please help me. My code is below for your kind consideration: function BVP clc clear all x = 0.5; x1=fzero(solver,x); end function F = solver(x) options= odeset('RelTol', 1e-8, 'AbsTol', [1e-8, 1e-8]); [t,u]=ode45(@equation, [0, 1], [1, x], options); s=length(t); F= u(s,1)-exp(1); figure(1) plot(t,u(:,1)) end function dy = equation(t,y) dy = zeros(2,1); dy(1) = y(2); dy(2) = t*exp(2*t)+y(1)-t*y(2)^2; end I would appreciate if you could have a look at it. Thank you.
@scientificrana56507 жыл бұрын
Correct the syntax ""x1=fzero(@solver,x);". You forgot to use "@" .
@95065959317 жыл бұрын
Thank you Dr. Rana, it worked now.
@ashwin21127 жыл бұрын
Hello Dr. Rana, In line 9, you use odeset function. I don't understand the actual use of it. I tried reading about it. And also I took it out of the code and it still solves. BR
@scientificrana56507 жыл бұрын
Odeset is necessary options only when you wish to change the tolerances. I mean you can loose the error thresholds using odeset to avoid default tolerances. If the tolerances are decreased, the accuracy of the result and the runtime is increased. This is more or less suitable depends on the complexity and requirement of problem equations. If you need rough results for millions of different initial conditions, larger tolerances are better. If you have enough time to wait and require accurate results, smaller tolerances should be preferred. Have a nice day!!
@ashwin21127 жыл бұрын
Thank you very much for the explanation. On a different note, I'm currently working on my masters thesis. It involves modelling and simulation of semiconductors. I'm faced with solving the drift-diffusion equations, which are basically set of second order nonlinear PDEs. For now I'm working on 1-D ODE form. I'm very new to discrete numerical techniques. I plan to use Galerkin's FEM technique to solve it. Would you have any comments or suggestion at this point.
@akshayram29444 жыл бұрын
Hlo Rana sir, I am trying to solve six dof coupled non linear differential equation which I am trying solve by using ode45 solver. But, the problem is that I need update the coordinates for Every time Interval. Can you help me out to solve it ?
@DrSohailAhmad-rr6he Жыл бұрын
Hlo Rana sir, I am trying to solve 4 coupled non linear differential equation which I am trying solve by using ode45 solver. Do you have any related video please send me the link
@ajeetkumarverma24836 жыл бұрын
hlo sir i run same code on my matlab R2013a it gives lots of warning in options line and one error in fzero solver line 5. how to handle this pls suggest me
@m.faisalhanif65923 жыл бұрын
Sir second video nh mile rhe ha is ki
@elsuave21347 жыл бұрын
Thanks Dr. Rana. I guess my problem is a small but funny one, probably because am still learning. I am supposed to use shooting method to solve a non-linear coupled ODE with boundary conditions. I have tried all possible ways but it seems not to be giving me expected results. Can i share you my code for corrections please?
@scientificrana56507 жыл бұрын
Have you gone through my another video on coupled nonlinear ODE solution kzbin.info/www/bejne/gXbcqYtomdadick If yes and didn't achieved success. You can send me your code for possible corrections to my email id scientificrana@gmail.com
@Priya-hu7db2 жыл бұрын
@@scientificrana5650 Sir,the video on coupled non linear ODE solution is not available to me. It is showing the video is private.Please tell the way by which I can watch the video..
@shahidrafiq9627 жыл бұрын
Dear Dr.Rana i m reciving the following error when i run your code. Plz guide Error using fzero (line 289) FZERO cannot continue because user-supplied function_handle ==> solver failed with the error below. Not enough input arguments. Error in shooting_utube (line 5) x1=fzero(@solver,x);
@scientificrana56507 жыл бұрын
Are you working on more than one unknowns?. If not then send me your code for possible correction on my email id scientificrana@gmail.com or you can copy and paste the entire code here in the comment. I will reply accordingly. Thanks
@shahidrafiq9627 жыл бұрын
Thanks for ur reply. here is the code : function shooting_method clc clear all x=0.5; x1=fzero(@solver,x); end function F=solver(x) options=odeset('ReTol',le-8,'AbsTol',[le-8,le-8]); [t,u]=ode45(@equation,[0 1],[1 x],options); s=length(t); F=u(s,1)-exp(1); figure(1) plot(t,u(:,1)) end function dy=equation(t,y) dy=zeros(2,1); dy(1)=y(2); dy(2)=t*exp(2*t)+y(1)-t*(y(2)^2); end
@scientificrana56507 жыл бұрын
please correct this line. options = odeset('RelTol',1e-8,'AbsTol',[1e-8 1e-8]);
@shahidrafiq9627 жыл бұрын
Thanks Dr. Rana code is running now.
@scientificrana56507 жыл бұрын
Most Welcome.
@emmitsawyer5 жыл бұрын
Dear Sir; What if I have a derivative BC in on the upper or lower limit of the domain?
@scientificrana56505 жыл бұрын
send me your problem on my email id scientificrana@gmail.com
@Levi-kq8ey6 жыл бұрын
Thank you
@DavidTrejoG7 жыл бұрын
LET'S GOOOOOOOOOOOOOOOO
@m.faisalhanif65923 жыл бұрын
Wo khn hn
@muhammadsafdar45412 жыл бұрын
anyone can help me i want to need BVP4C coding
@safdar96882 жыл бұрын
please help me sir
@mosespvarghese38356 жыл бұрын
I have a doubt to solve more than two differential equations using shooting technique. i have sent the required file and matter to your email address.
@scientificrana56506 жыл бұрын
kzbin.info/www/bejne/gXbcqYtomdadick
@mosespvarghese38356 жыл бұрын
i have sent the question to your email. The question is bit different. The boundary condition is not given
@m.faisalhanif65923 жыл бұрын
Is ka link shear kr do
@kachoabbas2094 Жыл бұрын
any one from here to do matlab program for me
@emilyglenn30666 жыл бұрын
Hello Dr. Rana! I sent you an email regarding this code. Please advise! Thank you very much! Best, Emily