This is great. Now I can solve my homework problem. My school thinks that we become great engineers by being taught nothing, but being forced to use specific solution techniques, such as ode45, to solve problems that we have no idea how to even work out on paper. Thankfully, there are great schools which put examples on KZbin.
@CPPMechEngTutorials6 жыл бұрын
Our motto is "Learn by doing." :)
@Handleoriginal128 ай бұрын
I wish I stumbled on this video sooner. My professor expected us to know matlab without ever being taught it. I might just make it with this guide now
@Handleoriginal128 ай бұрын
Update. I passed with a B. Thats a lot better than i expected. Thank you!
@imdavidsimon984 ай бұрын
Thank you so much. I love you motto ' Learn by doing', with a simple example, you helped many of us understand what our teachers wasn't able (willing in my case) to explain.
@Kay-dx8vm3 жыл бұрын
Finally, Thank you so much for this video. Ive been sitting for hours following instruction from my textbook with a bunch of errors.
@VDEngineering8 жыл бұрын
Could you please do a tutorial where the function has extra parameters which are time dependant? For example, the 6-DOF equations of motion have coefficients which change depending on the pitch angle and so on.
@ASIR0707076 ай бұрын
Great video, the first I watch learning about state-space presentation of ode. I followed the slides religiously and there is probably an error at 2:22. Last line: The first quantity (a_n-a/a_n) on the right-hand side of the equation should be multiplied by x_n and not x_n-1?
@lf198Ай бұрын
I noticed that, too. I'm surprised more comments aren't mentioning the mistake (cause, I'm pretty sure it should say x_n, instead) so that way it helps prevent incorrect note-taking.
@salimamansoura78383 жыл бұрын
May God reward you for all your effort and all the valuable information you easily provide to us .
@anasene66786 жыл бұрын
You just saved my life.Thank you!!!!
@CPPMechEngTutorials6 жыл бұрын
Saving lives is what we do.
@furn6341 Жыл бұрын
How can I plot y''-xy=0 with initial conditions y(0)=1, y'(0)=1 ?
@vipulkumar54368 жыл бұрын
at 2:22. shouldn't there be xn instead of xn-1 with (-an-1/an). talking about first expression on the RHS.
@leodaniel52455 жыл бұрын
You're right. Its a typo error.
@21seanlin Жыл бұрын
excuse me, if I solve nonhomogeneous ODEs, Do I need to convert r(x1) into yp obtained by the modification rule? and if I use this method, how to define C,Kcos,Msin. Or should I just add r(x1) directly like this: dy1dx1(4)=y1(4)*Coefb/Coefa-y1(3)* Coefc/Coefa-y1(2)*Coefd/Coefa-y1(1)*Coefe/Coefa+r(x1);
@stressedbyamountainofbooks9 ай бұрын
How do you do this if the known value for xdot is when t=10, this is not initial value
@ashishhirani86176 жыл бұрын
what is the meaning of (:,1) after the x in the plot function?
@cyber57876 жыл бұрын
It mean select every row from column 1 for matrix 1 6 2 7 3 8 4 9 5 10 Example: (1:3 , 1) mean select row 1 to 3 from column 1 which gives 1 2 3 Example: (2:3 , 2) mean select row 2 to 3 from column 2, which gives 7 8 if ( a:b, 1) and a, b are omitted, it mean select everything from column 1 Hope that help :D
@DhruvPatel-jf5gg Жыл бұрын
ultimately we are finding x right??...How Matlab going to find it from xdot=[xdot1,xdot2] values?...please guide me!!
@bhupenderkumarsom1975 Жыл бұрын
struggling to solve a system of equations, could you please help me. It is a single server queuing model.
@ghufransyed2 жыл бұрын
thank for this video, really helped me understand how to use the matlab ode function!
@CPPMechEngTutorials2 жыл бұрын
Glad it helped!
@engi58435 жыл бұрын
ODE I wanna cry Industrial Engineering TT
@virtually_passed6 жыл бұрын
This will also work: [t,x] = ode45(@(t,x) func(t,x),[1,5],[5 3]); %solves EoM and generates vector of time values from 1-5 with initial conditions x0=3 and v0=3 figure plot(t,x(:,1)) hold on plot(t,x(:,2)) function xdot = func(t,x) %Outputs EoM in stae space form xdot = f(t,x) xdot(1)=x(2); xdot(2) = 20-7*x(2)-10*x(1); xdot=xdot'; end
@rah10928 жыл бұрын
what is - xdot - for? am i able to use it for equations whose independent variable is not time? thanks
@CPPMechEngTutorials8 жыл бұрын
"t" is any independent variable. In dynamic systems, time is usually the independent variable.
@alemayehuwakjira73376 жыл бұрын
Dear sir thank you for your lecture on using ode45 for state variable solutions. my question is, is the name func a predefined name that can not be changed to other name? should I necessarily replace every time I save my file with same name func?
@LL-kn1de6 жыл бұрын
Thank you! This really helps! Can you do a 2nd order d.e relate with RLC circuit problem?
@christostsombos89235 жыл бұрын
How can i use Ode45 if dx(2) is a piecewise function?
@EnDivine7 жыл бұрын
Very well explained sir! Thank you very much! :) :)
@CPPMechEngTutorials7 жыл бұрын
We are glad you liked the video.
@manarbuqai72314 жыл бұрын
THANK YOUUUUU CPPMECHENG :):)
@nitinparate78573 жыл бұрын
How can we use ode45 inside a for loop
@christopherstockman69175 жыл бұрын
This helped... thanks! So this gives us the plot. But what can I do get the actual final equation of x?
@AntonHax6 жыл бұрын
Thanks K-J! you helped us greatly, from sweden with kisses xxxo
@CPPMechEngTutorials6 жыл бұрын
We're glad it helped.
@crosser79842 жыл бұрын
Thank You. You made my day. I've got errors that odearguments must return a column vector. Transposition at the end of function solved the problem. Thank you very much :D :D :D :D :D
@whitenancy43497 жыл бұрын
Thank you so much sir. I have a question that I would like to ask you If I have an equation: dy/dx = 8*y^k - 3*y The given numbers: k=[0.1:0.01:0.2] y0=0.6 x=[0 10] y1=2 How can I use ODE to solve the equation and use that solution to find x1 (x1 is at y1) for every value of k. CANNOT use arrayfun or find.
@toastyh7062 жыл бұрын
Thanks for the tutorial, it helped!
@bienvenidoperez66306 жыл бұрын
Is also possible for an ODE no homogenous?
@owen71852 жыл бұрын
Awesome video 👍👍
@alyajazmina92155 жыл бұрын
Shouldn't it be (:,2)) instead of 1?
@debasis3567 жыл бұрын
What if the boundary condition x(0)=5; and x(10)=3. In my case, in boundary condition in place of xdot, x is given.
@TaterBot10007 жыл бұрын
Hey there. The ode isn't solvable unless all initial conditions at a particular given time is known. Thus having x(0) and x(10) doesn't help. Nor does having x(0) and xdot(10) or xdot(0) and xdot(10). None of those combinations make the problem solvable. In order to obtain a solution, you need x(0) and xdot(0) or x(10) and xdot(10), etc.
@debayan73 жыл бұрын
you can use shooting method that will convert the boundary value problem to initial value problem. there are videos on this
@Phamquest7 жыл бұрын
Very informative and clear, thanks!
@CPPMechEngTutorials7 жыл бұрын
No problem.
@kelvinjaramillo80075 жыл бұрын
X2
@manojdhanda29405 жыл бұрын
great video cleared everything in 1 video thank you
@CPPMechEngTutorials5 жыл бұрын
Great!
@James-sh7rr6 жыл бұрын
Very helpful. Thank you for sharing!
@CPPMechEngTutorials6 жыл бұрын
No problem
@haddedarbia41417 жыл бұрын
hi plz can we use ode45 to solve a differential equation with non-constant coefficients !!
@TaterBot10007 жыл бұрын
If you're still searching for an example like that, you can find one in this video. kzbin.info/www/bejne/noOcgGqpi7R0qKc The link already connects you to the example problem. There really isn't much difference with non-constant coefficients, so you've likely found out how by now.
@DrUARaja6 жыл бұрын
Yes we can
@magnifiedmicrons8 жыл бұрын
very very good one thanks a lot-............ it really helped me a lot
@CPPMechEngTutorials8 жыл бұрын
You're welcome.
@Travel_n_Climb4 жыл бұрын
Thanks a ton! Was really helpful. :) Was looking for just this
@cuongho70076 жыл бұрын
if coeficient is matrix so how i can do it..
@bienvenidoperez66306 жыл бұрын
I'm doing a problem with matrix and no homogenous. Have the answer?
@shilpaagrawal21054 ай бұрын
In this same way, kindly solve second order differential equation for van der pol system
@ryan-oe6ft6 жыл бұрын
Thank you. The MatLab help files were very difficult to understand.
@CPPMechEngTutorials6 жыл бұрын
No problem.
@skeletonrowdie17686 жыл бұрын
wow! so nice and compact! thanks!
@christos16035 жыл бұрын
thank you so much for this !
@CPPMechEngTutorials5 жыл бұрын
You're welcome!
@Ankit-df8rw5 жыл бұрын
thank u man!!! life saver
@CPPMechEngTutorials5 жыл бұрын
You are welcome!
@zhenisotarbay51595 жыл бұрын
[t,x]=ode45('func',[0 5],[5 3]); Error using ode45 Too many input arguments.
@civelyze5 жыл бұрын
Thanks buddy 👍
@user-fo5jv3zu8jn22 жыл бұрын
감사합니다.
@Hudmyq6 жыл бұрын
Hi, I dont know if you can read this. Thanks for your video. It is very clear. However, the problem what I'm trying to solve is two variables 2nd order differential equation set. For example, 32 * d^2x1/dt^2 + 48* d^2x2/dt^2 +3*dx1/dt +x1=0 ; 14*d^2x1/dt^2 +1.732*d^2x2/dt^2 +10* dx2/dt+ x2=0 . Can you please tell me how to do it in matlab ?
@Ziyad_A5 жыл бұрын
Thanks Dr.
@saddamhussainsoomro28106 жыл бұрын
why x(: ?????
@BabyVedaChanel8 жыл бұрын
z,t -C/ ρs V (x)kϕ(x)(1 + z2 ,x)-k/2 = 0 i want simulate this equation in mat lab please help me
@cyrusIIIII8 жыл бұрын
what if you have system of equations of second order?
@CPPMechEngTutorials8 жыл бұрын
If you have N second order ODEs, you need to convert them to 2*N first order ODEs.
@cyrusIIIII8 жыл бұрын
CPPMechEngTutorials Yes but what if they depend on each other for example I have xdoubledot in both of my equations?
@sunitadeb60766 жыл бұрын
thank you
@austinwalker5176 Жыл бұрын
MATLAB gives a "Not enough input arguments" error code, a "Unrecognized function or variable 'func'. Bad example.
@Rockstar13768 жыл бұрын
Thanks
@CPPMechEngTutorials8 жыл бұрын
You're welcome.
@amnaalshamsi64006 жыл бұрын
thank yoooooooou from Oman
@shivjikhanath3586 Жыл бұрын
Best
@mjl78104 жыл бұрын
Knew you were a korean
@hernanes55338 жыл бұрын
buenas vi tu codigo y me parece muy interesante... por favor me podrias ayudar a resolver esta practica soy muy novato en matlab.. solohernanes@gmail.com 2 IDENTIFICACIÓN COMPETENCIAS CONTENIDO TEMÁTICO INDICADOR DE LOGRO Modelar matemáticamente sistemas analógicos SLTI. Sistemas lineales e invariantes en el tiempo - SLTI: Modelado de sistemas mediante ecuaciones diferenciales. Respuesta de entrada cero. Respuesta de estado cero. Estabilidad IIBO y BIBO. Representa matemáticamente un sistema en el dominio del tiempo mediante EDO. Representa matemáticamente un sistema en el dominio de la frecuencia mediante transformada de Laplace. Halla la respuesta de un sistema ante cualquier excitación. Determina la estabilidad IIBO y BIBO de un sistema a través de la ubicación de los polos. 3 RECURSOS REQUERIDOS • Equipo de cómputo: Matlab, TheMathworks Inc. 4 PROCEDIMIENTO Un sistema lineal invariante en el tiempo (SLTI - linear and time invariant) se puede modelar mediante la ecuación diferencial: Σ𝑎𝑖𝐷^(𝑖)𝑦(𝑡)𝑛𝑖=0=Σ𝑏𝑖𝐷^(𝑗)𝑥(𝑡)𝑚𝑗=0 Donde la respuesta total 𝑦(𝑡) está dada por la respuesta de entrada cero (zero input) más la respuesta de estado cero (zero state): 𝑦(𝑡)=𝑦𝑧𝑖(𝑡)+𝑦𝑧𝑠(𝑡)=Σ𝑐𝑘𝑒^(𝜆𝑘𝑡)+𝑥(𝑡)∗ℎ(𝑡) Donde ℎ(𝑡) es la respuesta al impulso, 𝜆𝑘 es la 𝑘-ésima raíz de la ecuación característica y 𝑐𝑘 son constantes a determinar con las condiciones iniciales. La función de transferencia del sistema se define como: ℒ{ℎ(𝑡)}=𝐻(𝑠)=𝑌(𝑠)𝑋(𝑠)=Σ𝑏𝑖𝑠^𝑗=0Σ𝑎𝑖𝑠^𝑖=0=Σ𝑏𝑖𝑠^𝑗=0Π(𝑠−𝜆𝑘) 4.1 PROCEDIMIENTO DE LA PRÁCTICA Dado el sistema: 𝑎𝑛*(𝑑^𝑛*𝑦(𝑡))/(𝑑𝑡^𝑛)+𝑎𝑛−1*𝑑^𝑛−1𝑦(𝑡)/𝑑𝑡^𝑛−1+⋯+𝑎1𝑑𝑦(𝑡)𝑑𝑡+𝑎0𝑦(𝑡)=𝑏𝑚𝑑𝑚𝑥(𝑡)𝑑𝑡𝑚+𝑏𝑚−1𝑑𝑚−1𝑥(𝑡)𝑑𝑡𝑚−1+⋯+𝑏1𝑑𝑥(𝑡)𝑑𝑡+𝑏0𝑥(𝑡) Diseñe una rutina en Matlab que tenga como parámetros de entrada única y exclusivamente 𝑏, 𝑎, las condiciones iniciales del sistema y la ecuación de la señal de entrada. Tanto 𝑏 como 𝑎 se deben ingresar como vectores y no se le debe exigir al usuario que ingrese estos elementos número por número. Las condiciones iniciales sí se pueden pedir de forma individual, es decir, una por una. Con esta información que se le pide al usuario, el programa debe hacer lo siguiente: a. Grafique los polos del sistema en el plano de Argand. b. Indique en una ventana emergente si el sistema es IIBO estable, inestable o marginalmente estable. c. Indique en otra ventana emergente si el sistema es BIBO estable, inestable o marginalmente estable. d. Muestre en la ventana de comando la función de transferencia del sistema. e. Muestre en la ventana de comando la respuesta de entrada cero. f. Muestre en la ventana de comando la respuesta de estado cero. g. Muestre una gráfica con cuatro subplots que muestren 𝑥(𝑡),𝑦(𝑡),𝑦𝑧𝑖(𝑡) e 𝑦𝑧𝑠(𝑡) en el intervalo 0≤𝑡≤10. 5 PARÁMETROS PARA ELABORACIÓN DEL INFORME a. Funciones y comandos útiles: eval, roots, dsolve, int, laplace, syms, entre otros. b. Debe ser cuidadoso al etiquetar los ejes y las gráficas. Gráfica sin etiquetas no se tendrán en cuenta. c. Envíe los scripts en un solo archivo .m