ME 340: Example, Solving ODEs using MATLAB's ode45 command

  Рет қаралды 261,481

CPPMechEngTutorials

CPPMechEngTutorials

8 жыл бұрын

Want to see more mechanical engineering instructional videos? Visit the Cal Poly Pomona Mechanical Engineering Department's video library, ME Online (www.cpp.edu/meonline).

Пікірлер: 88
@brynmrsh
@brynmrsh 5 жыл бұрын
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.
@CPPMechEngTutorials
@CPPMechEngTutorials 5 жыл бұрын
Our motto is "Learn by doing." :)
@Handleoriginal12
@Handleoriginal12 2 ай бұрын
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
@Handleoriginal12
@Handleoriginal12 Ай бұрын
Update. I passed with a B. Thats a lot better than i expected. Thank you!
@Kay-dx8vm
@Kay-dx8vm 3 жыл бұрын
Finally, Thank you so much for this video. Ive been sitting for hours following instruction from my textbook with a bunch of errors.
@VDEngineering
@VDEngineering 7 жыл бұрын
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.
@anasene6678
@anasene6678 6 жыл бұрын
You just saved my life.Thank you!!!!
@CPPMechEngTutorials
@CPPMechEngTutorials 6 жыл бұрын
Saving lives is what we do.
@alemayehuwakjira7337
@alemayehuwakjira7337 6 жыл бұрын
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?
@salimamansoura7838
@salimamansoura7838 3 жыл бұрын
May God reward you for all your effort and all the valuable information you easily provide to us .
@LL-kn1de
@LL-kn1de 5 жыл бұрын
Thank you! This really helps! Can you do a 2nd order d.e relate with RLC circuit problem?
@EnDivine
@EnDivine 7 жыл бұрын
Very well explained sir! Thank you very much! :) :)
@CPPMechEngTutorials
@CPPMechEngTutorials 7 жыл бұрын
We are glad you liked the video.
@whitenancy4349
@whitenancy4349 6 жыл бұрын
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.
@manarbuqai7231
@manarbuqai7231 4 жыл бұрын
THANK YOUUUUU CPPMECHENG :):)
@AntonHax
@AntonHax 6 жыл бұрын
Thanks K-J! you helped us greatly, from sweden with kisses xxxo
@CPPMechEngTutorials
@CPPMechEngTutorials 6 жыл бұрын
We're glad it helped.
@christopherstockman6917
@christopherstockman6917 4 жыл бұрын
This helped... thanks! So this gives us the plot. But what can I do get the actual final equation of x?
@engi5843
@engi5843 5 жыл бұрын
ODE I wanna cry Industrial Engineering TT
@toastyh706
@toastyh706 2 жыл бұрын
Thanks for the tutorial, it helped!
@alarkthakkar1499
@alarkthakkar1499 4 жыл бұрын
Thanks a ton! Was really helpful. :) Was looking for just this
@skeletonrowdie1768
@skeletonrowdie1768 5 жыл бұрын
wow! so nice and compact! thanks!
@James-sh7rr
@James-sh7rr 6 жыл бұрын
Very helpful. Thank you for sharing!
@CPPMechEngTutorials
@CPPMechEngTutorials 6 жыл бұрын
No problem
@ghufransyed
@ghufransyed 2 жыл бұрын
thank for this video, really helped me understand how to use the matlab ode function!
@CPPMechEngTutorials
@CPPMechEngTutorials 2 жыл бұрын
Glad it helped!
@furn6341
@furn6341 9 ай бұрын
How can I plot y''-xy=0 with initial conditions y(0)=1, y'(0)=1 ?
@manojdhanda2940
@manojdhanda2940 5 жыл бұрын
great video cleared everything in 1 video thank you
@CPPMechEngTutorials
@CPPMechEngTutorials 4 жыл бұрын
Great!
@christostsombos8923
@christostsombos8923 4 жыл бұрын
How can i use Ode45 if dx(2) is a piecewise function?
@21seanlin
@21seanlin 8 ай бұрын
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);
@bienvenidoperez6630
@bienvenidoperez6630 5 жыл бұрын
Is also possible for an ODE no homogenous?
@crosser7984
@crosser7984 2 жыл бұрын
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
@owen7185
@owen7185 2 жыл бұрын
Awesome video 👍👍
@magnifiedmicrons
@magnifiedmicrons 7 жыл бұрын
very very good one thanks a lot-............ it really helped me a lot
@CPPMechEngTutorials
@CPPMechEngTutorials 7 жыл бұрын
You're welcome.
@stressedbyamountainofbooks
@stressedbyamountainofbooks 2 ай бұрын
How do you do this if the known value for xdot is when t=10, this is not initial value
@Phamquest
@Phamquest 6 жыл бұрын
Very informative and clear, thanks!
@CPPMechEngTutorials
@CPPMechEngTutorials 6 жыл бұрын
No problem.
@kelvinjaramillo8007
@kelvinjaramillo8007 5 жыл бұрын
X2
@DhruvPatel-jf5gg
@DhruvPatel-jf5gg Жыл бұрын
ultimately we are finding x right??...How Matlab going to find it from xdot=[xdot1,xdot2] values?...please guide me!!
@ASIR070707
@ASIR070707 25 күн бұрын
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?
@bhupenderkumarsom1975
@bhupenderkumarsom1975 Жыл бұрын
struggling to solve a system of equations, could you please help me. It is a single server queuing model.
@ashishhirani8617
@ashishhirani8617 5 жыл бұрын
what is the meaning of (:,1) after the x in the plot function?
@cyber5787
@cyber5787 5 жыл бұрын
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
@christos1603
@christos1603 5 жыл бұрын
thank you so much for this !
@CPPMechEngTutorials
@CPPMechEngTutorials 5 жыл бұрын
You're welcome!
@rah1092
@rah1092 7 жыл бұрын
what is - xdot - for? am i able to use it for equations whose independent variable is not time? thanks
@CPPMechEngTutorials
@CPPMechEngTutorials 7 жыл бұрын
"t" is any independent variable. In dynamic systems, time is usually the independent variable.
@Ziyad_A
@Ziyad_A 5 жыл бұрын
Thanks Dr.
@atakangungor3438
@atakangungor3438 5 жыл бұрын
You are the Krall !!
@vipulkumar5436
@vipulkumar5436 7 жыл бұрын
at 2:22. shouldn't there be xn instead of xn-1 with (-an-1/an). talking about first expression on the RHS.
@leodaniel5245
@leodaniel5245 4 жыл бұрын
You're right. Its a typo error.
@sunitadeb6076
@sunitadeb6076 6 жыл бұрын
thank you
@nitinparate7857
@nitinparate7857 2 жыл бұрын
How can we use ode45 inside a for loop
@user-fo5jv3zu8jn2
@user-fo5jv3zu8jn2 2 жыл бұрын
감사합니다.
@amnaalshamsi6400
@amnaalshamsi6400 6 жыл бұрын
thank yoooooooou from Oman
@aajamerepyar4586
@aajamerepyar4586 Ай бұрын
how can we plot x' vs t or x' vs x
@civelyze
@civelyze 4 жыл бұрын
Thanks buddy 👍
@alyajazmina9215
@alyajazmina9215 4 жыл бұрын
Shouldn't it be (:,2)) instead of 1?
@Ankit-df8rw
@Ankit-df8rw 4 жыл бұрын
thank u man!!! life saver
@CPPMechEngTutorials
@CPPMechEngTutorials 4 жыл бұрын
You are welcome!
@debasis356
@debasis356 7 жыл бұрын
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.
@TaterBot1000
@TaterBot1000 6 жыл бұрын
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.
@debayan7
@debayan7 3 жыл бұрын
you can use shooting method that will convert the boundary value problem to initial value problem. there are videos on this
@ryan-oe6ft
@ryan-oe6ft 5 жыл бұрын
Thank you. The MatLab help files were very difficult to understand.
@CPPMechEngTutorials
@CPPMechEngTutorials 5 жыл бұрын
No problem.
@haddedarbia4141
@haddedarbia4141 7 жыл бұрын
hi plz can we use ode45 to solve a differential equation with non-constant coefficients !!
@TaterBot1000
@TaterBot1000 6 жыл бұрын
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.
@DrUARaja
@DrUARaja 5 жыл бұрын
Yes we can
@BabyVedaChanel
@BabyVedaChanel 7 жыл бұрын
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
@virtually_passed
@virtually_passed 5 жыл бұрын
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
@Rockstar1376
@Rockstar1376 8 жыл бұрын
Thanks
@CPPMechEngTutorials
@CPPMechEngTutorials 7 жыл бұрын
You're welcome.
@cuongho7007
@cuongho7007 6 жыл бұрын
if coeficient is matrix so how i can do it..
@bienvenidoperez6630
@bienvenidoperez6630 5 жыл бұрын
I'm doing a problem with matrix and no homogenous. Have the answer?
@Hudmyq
@Hudmyq 6 жыл бұрын
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 ?
@saddamhussainsoomro2810
@saddamhussainsoomro2810 5 жыл бұрын
why x(: ?????
@zhenisotarbay5159
@zhenisotarbay5159 4 жыл бұрын
[t,x]=ode45('func',[0 5],[5 3]); Error using ode45 Too many input arguments.
@shivjikhanath3586
@shivjikhanath3586 7 ай бұрын
Best
@cyrusIIIII
@cyrusIIIII 7 жыл бұрын
what if you have system of equations of second order?
@CPPMechEngTutorials
@CPPMechEngTutorials 7 жыл бұрын
If you have N second order ODEs, you need to convert them to 2*N first order ODEs.
@cyrusIIIII
@cyrusIIIII 7 жыл бұрын
CPPMechEngTutorials Yes but what if they depend on each other for example I have xdoubledot in both of my equations?
@austinwalker5176
@austinwalker5176 7 ай бұрын
MATLAB gives a "Not enough input arguments" error code, a "Unrecognized function or variable 'func'. Bad example.
@mjl7810
@mjl7810 4 жыл бұрын
Knew you were a korean
@hernanes5533
@hernanes5533 8 жыл бұрын
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
Lec13 Solving ODEs using ode45 in Matlab
40:37
Jose Gutierrez
Рет қаралды 45 М.
ME 340: Example, Solving ODEs using MATLAB's laplace command
5:29
CPPMechEngTutorials
Рет қаралды 29 М.
OMG🤪 #tiktok #shorts #potapova_blog
00:50
Potapova_blog
Рет қаралды 18 МЛН
Жайдарман | Туған күн 2024 | Алматы
2:22:55
Jaidarman OFFICIAL / JCI
Рет қаралды 1,6 МЛН
Incredible magic 🤯✨
00:53
America's Got Talent
Рет қаралды 36 МЛН
He sees meat everywhere 😄🥩
00:11
AngLova
Рет қаралды 11 МЛН
Matlab ode45 (and Similar) Tutorial Part 1: The Basics
48:55
Scholastic Samaritan
Рет қаралды 49 М.
Solving Differential Equations in Matlab Simulink
7:37
Eng. Radfan Ojailah
Рет қаралды 33 М.
Solving Ordinary Differential Equations Using MATLAB
19:37
MATLAB ode45 algorithm
16:41
MATLAB Programming for Numerical Computation
Рет қаралды 85 М.
MATLAB's ode45 Solver - Single Degree-of-Freedom Oscillator
9:33
Jousef Murad | Deep Dive
Рет қаралды 23 М.
Numerically Solve Differential Equations in MATLAB | #ode45 examples
10:01
Vectoring Words (Word Embeddings) - Computerphile
16:56
Computerphile
Рет қаралды 283 М.
Solve First Order Ordinary Differential Equation in MATLAB using ode45
6:07
OMG🤪 #tiktok #shorts #potapova_blog
00:50
Potapova_blog
Рет қаралды 18 МЛН