Solving Second Order Differential Equations in Matlab

  Рет қаралды 389,979

Jake Blanchard

Jake Blanchard

Күн бұрын

Пікірлер: 182
@Jono.
@Jono. 5 жыл бұрын
11 years later and I don't think there has been a more clear video describing how to use this function. Thank you!
@bcerme16
@bcerme16 5 жыл бұрын
5:45 is my favourite moment: The way he says "MASS"
@dansportdr123
@dansportdr123 11 жыл бұрын
I saved my function as a .m file and it worked. I was just confused about that at first. Thanks for the helpful video and quick reply!
@멜리사-j3w
@멜리사-j3w 11 жыл бұрын
This is an awesome video! I had no idea how to use ode45, and then BAM! I understand how :D Thanks for the great video!
@simensikkeland8862
@simensikkeland8862 11 жыл бұрын
Hey Jake, when you define the function in your video in matlab; if is y(2) = the acceleration term, then the velocity term for the drag force shouldnt that be y(1)? I think im confused that you use y(2) in both terms. Could you elaborate? Thanks
@sheesh1706
@sheesh1706 4 жыл бұрын
Very enlightening video. A few observations. I think m here is the distance and not mass. It is not dimensionally consistent. I also believe it is y(1,:) for indexing into the array?
@jakeblanchard
@jakeblanchard 4 жыл бұрын
No, m is mass. What might be throwing you off is that the number in the last term (4/15) has dimensions such that 4/15*V^2 has force units. Regarding your second comment, y(:,1) will return vertical position (y in the equations in the slides) at all times. y(:,2) will give velocities (dy/dt) at all times.
@sheesh1706
@sheesh1706 4 жыл бұрын
Jake Blanchard thanks for taking the time to reply. Really appreciate it
@jakeblanchard
@jakeblanchard 12 жыл бұрын
It works just like this example. You'll have two second order equations. You have to break those down into four first order equations. Then the process is just like in the video, except the vectors are larger.
@rabo2015
@rabo2015 4 жыл бұрын
thanks dear, I have two coupled differential equations that I am going to try using this method. If I may face challenges you may help me! thanks!
@Rachy530
@Rachy530 11 жыл бұрын
I'm trying to use ode45 to solve a system of equations. When I run the file it keeps saying: 'Error using ode45 (line 88) Not enough input arguments. See ODE45.' When I run the function it says: Undefined function or variable 't'. My code looks the same as to loads of codes I've seen, any thoughts on what to do for this?
@jakeblanchard
@jakeblanchard 11 жыл бұрын
plot(t,y(:,1)), plots the first column of y, which is the height. To get the velocity, you plot the second column. plot(t,y(:,2))
@michaeljankowski4627
@michaeljankowski4627 3 жыл бұрын
Thanks so much!!
@MichaelBrown-ri8wl
@MichaelBrown-ri8wl 8 жыл бұрын
found this very helpful, much better explanation than my professor, thank you.
@jakeblanchard
@jakeblanchard 12 жыл бұрын
Everything in this video is Runge-Kutta for an initial value problem. Shooting methods are for boundary value problems. I have a separate video on boundary value problems, but it uses finite differences, not shooting methods. By the way, shooting methods do often use Runge Kutta methods, but it requires iteration to get the boundary conditions right.
@davidwooding
@davidwooding 14 жыл бұрын
@davidwooding In this case, you are given the initial conditions (p(0)=0, p'(0)=1), but you must guess a value for parameter (k) by trying a sample of values for k. For each k-value guess, you can calculate a solution p(x,k) and match this to see how good this is against the end condition (x=L) for the original BVP, p(L)=0. Hence, the problem is all about finding the correct k's, so that in the mode solutions p(L,k)=0
@lolochick101
@lolochick101 12 жыл бұрын
This problem does work but your have to be REALLY careful because little mistakes make a HUGE deal. Main issues I looked over: 1. [], (), {}, and ; make sure these are in the right place. 2. make sure the decimals are places before the ^ or * sign of a matrix (y(2).^2) 3. call the correct matrix y(2) not y(1) 4. define all variables 5.SAVE the file named after the function (this should be 1 because this is commonly forgotten.) cheers
@davidwooding
@davidwooding 14 жыл бұрын
@jakeblanchard the next part of the question is using the shooting method find resonance wavenumbers k with relative accuract 10^-4 find resonance frequencies f. When you say look for the value of k which gives p=0 at x=L how do i do this? I have everything working from your method :) but this part is really confusing me. Thank you so much for your help.
@jakeblanchard
@jakeblanchard 11 жыл бұрын
y(1) is the height. y(2) is the derivative of the height, which is velocity.
@pawanmandawat
@pawanmandawat 14 жыл бұрын
Hey i got the way to do that... thanks very much for showing the way....... thanks a ton...... waiting for your other videos..........
@lukeutterback7073
@lukeutterback7073 2 жыл бұрын
you're a life saver
@jamesh9218
@jamesh9218 9 жыл бұрын
Hi Jake. This second order ODE, in the form d2y/dt2 = f(t, y, dy/dt), only contains the variable V = dy/dt on the RHS. It does not contain the variable y. If it had also contained y, how would this have changed things? Would the equation in the second element of rk just be a function of y(1) also? Thanks
@jakeblanchard
@jakeblanchard 9 жыл бұрын
+James H Yes, y(1) represents the "y" in the equation and y(2) represents "dy/dt", so you can use y(1) to represent "y" in rk as needed.
@abdulmumeen1124
@abdulmumeen1124 8 жыл бұрын
Hello,mr. Jake.You have presented a nice lecture.You have relieved some of bugs.Thank you for the great job. However,i have an observation i would like to look in into. Looking at the model equation,d^2y/dt^2 = -g+4*V^2/M*15,it is clear that acceleration is a function Velocity.I now wonder how dz/dt now replace V in your code.From by physics background,i can say that change in velocity gives acceleration,as well as change in distance gives velocity.Please,i would like you share more light of this confusion i am thrown into. Thank you!
@jakeblanchard
@jakeblanchard 8 жыл бұрын
+Abdul Mumeen In this solution, y(1) represents the position and y(2) represents the first derivative of the position, or velocity. So, in the slide that starts at about 5:23 in the video, you can see that y(2) is used where we need to use velocity.
@abdulmumeen1124
@abdulmumeen1124 8 жыл бұрын
+Jake Blanchard Okay,thank u.
@pikachu832
@pikachu832 14 жыл бұрын
@jakeblanchard I think you have cleared a lot of things for me. =) But just to confirm... how does matlab know that y(2) = dy/dt? Why is it not y(1)? I suspect it has something to do with the initial values you specified later; if y(2) = dy/dt, then y(2) =z. The 2nd variable in your initial values so happens to be z0 (zinitial). So can I ask if there is a direct link between the inital values implemented and the vector y that MATLAB reads in the previous function file? Thanks again. =)
@zoro19840
@zoro19840 15 жыл бұрын
Thank you very much !! Now it works, I need another favor please: how to solve : m(d^2/dt^2)+c(dx/dt)+kx=u(t); with initial conditions: x(0)=1, (dx/dt)(0)=2; and u(t) is input = sin(2*pi*t)
@sriramskumar1265
@sriramskumar1265 4 жыл бұрын
I have been Euler integrating for years without knowing this video existed.
@Deqster
@Deqster 13 жыл бұрын
Thanks for this, I couldn't figure out why my code wasn't working...everything looked good. Then I realized I forgot to define g. Dang I want those two hours of my life back! Lol
@asyrafdanial4331
@asyrafdanial4331 7 жыл бұрын
Morgan freeman?
@jakeblanchard
@jakeblanchard 11 жыл бұрын
PECE stands for predict-evaluate-correct-evaluate. It's a different way to solve an ordinary differential equation numerically. There isn't really enough room here to comment further on this or the stiff ode questions. A "google" search will get you some answers.
@Frances3654
@Frances3654 9 жыл бұрын
Thank you! This had me stuck for hours.
@bancuk
@bancuk 14 жыл бұрын
@jakeblanchard what does y(2) and y(1) means? I have never used matlab to solve differential equation? How can y has two meanings, as T and dT/dx? Thanks.
@pawanmandawat
@pawanmandawat 14 жыл бұрын
Hey Just a quick question, how can we call this 'f.m' file using [t,y]=ode45(@secode,[0 30],[600 0]); in another *.m file because here what we are doing is calling it in Command Video. Because when i am trying it in a *.m file it is giving me the following error... ??? Undefined function or method 'falling' for input arguments of type 'char'. where falling is my file name. Thanks a lot.....
@jakeblanchard
@jakeblanchard 11 жыл бұрын
It looks well posed. But it's a boundary value problem. You might check out the bvp4c routine in Matlab. I have a video on it, but I'm not sure how to link to it here because they won't accept links in comments. Just search for boundary value or browse this channel.
@lolochick101
@lolochick101 12 жыл бұрын
How exactly do you put in for four odes using the method you have illustrated to solve two second orders?
@pikachu832
@pikachu832 14 жыл бұрын
I have a question, if it is not obvious that you are given a 2nd order diffrential equation, how do you go about making it into one? Also, the last matrix at about 5.25; do they have to be [dy/dt; d2y/dt2]??? Many thanks.
@jakeblanchard
@jakeblanchard 12 жыл бұрын
It's pretty much the same process. You break the two second order ODE's into first order equations, giving a set of four first order ODE's. Then you have four initial conditions. Everything is the same as in this video, except all the vectors are twice as big. You can email me if you have more questions.
@CaptainRussia89
@CaptainRussia89 11 жыл бұрын
Hey jake, what if I wanted to plot the velocity vs time instead of height
@davidwooding
@davidwooding 14 жыл бұрын
@jakeblanchard i am really sorry but this is where i am confused. I have plotted plot(x,p(:,1)) for what ever value of k i chose the graph will always cross the x axis where y=0 Im really grateful for your help, i appreciate this most likely doesnt come across well and might be confusing to see what i have done without seeing my mfile
@pawanmandawat
@pawanmandawat 14 жыл бұрын
Yeah sorry about that,i didn't mentioned that, yeah the file 'f.m' here is 'secode.m' and what i basically want is to call this 'f.m' or 'secode.m' function in another '*.m' file which is 'falling.m' not in command wiindow. Thanks very much for reply.
@jakeblanchard
@jakeblanchard 11 жыл бұрын
@8e500 The % symbol indicates a comment. Matlab ignores everything after the %.
@shiladityamajumdar7215
@shiladityamajumdar7215 6 жыл бұрын
Thank you very much sir it was very helpful but I have a question. How do you find the time required to reach the ground?
@jakeblanchard
@jakeblanchard 6 жыл бұрын
I'm not aware of a direct way to do this. You could solve past the point it hits the ground, fit the data to a polynomial, and then find the root of the polynomial. Another approach would be to set up a function that calculates the vertical position as a function of time and then use a standard root-finder to find the time where the vertical position is 0. This would be inefficient, because it would have to solve the entire problem every time the function is called, but it should work.
@anuraagbhatt
@anuraagbhatt 12 жыл бұрын
i liked your vedio... i would like to run a simulation of double pendulum, where i have two variables 'theta1' and 'theta2' dependent on 't'...the equations are implicit and theta1 and theta2 are not separated. how can i solve it ?
@neosagun
@neosagun 11 жыл бұрын
Is it possible to generate analytical solutions using this method?
@hppaviliona1700la
@hppaviliona1700la 7 жыл бұрын
If i write in matlab what you wrote under "the solution", should I get the graph you got, or do I have write something before that? This question arises because in that code t is not defined, y is not defined and f is not defined.
@jakeblanchard
@jakeblanchard 7 жыл бұрын
HP Pavilion You also need "the function" from the previous slide.
@jakeblanchard
@jakeblanchard 12 жыл бұрын
To answer your other question, the "rk" is just a name I chose for a user defined function. You can call it whatever you'd like.
@wildreams
@wildreams 14 жыл бұрын
have a question.. shouldn't it be 4/15 instead of 4/14 in your ode function?
@NewtonianMind
@NewtonianMind 12 жыл бұрын
at 5:25, shouldn't dz/dt be in the first box, and dy/dt be on the second box?
@dansportdr123
@dansportdr123 11 жыл бұрын
Do you save the 'y vector' somewhere else? I typed in what you have and it says y is undefined
@kaoson2K8
@kaoson2K8 11 жыл бұрын
You are saving my life!
@jakeblanchard
@jakeblanchard 11 жыл бұрын
ode45 will do the trick. I have a video called "Solve Ordinary Differential Equations in Matlab" that describes it for first order equations.
@martinl1267
@martinl1267 8 жыл бұрын
Under the function rk, why is z=dy/dt written as y(2), what does the (2) do and mean?
@jakeblanchard
@jakeblanchard 8 жыл бұрын
In Matlab y is a vector. It holds the variable you are trying to solve for (also called y in the equation itself) and it also holds z, which is the first derivative of y. So the y(2) refers to the second variable, which is what you called z above.
@bancuk
@bancuk 14 жыл бұрын
@jakeblanchard what if the coefficient of the ODE is a variable: d²T/dx² -(m+n sin(kx)) T = q + p sin (kx) m,n,q, and p are constant how to solve this?
@Likwidl
@Likwidl 11 жыл бұрын
I think when you call the ode45 you have to specify the options first?
@jakeblanchard
@jakeblanchard 11 жыл бұрын
You have to separate the function from the rest of the code. Try something like the stuff pasted in below. The results don't look too good, but at least it runs. function testit() timerange=[0 2]; initialvalues=[0 51041666.667]; [t,y]=ode45(@f,timerange, initialvalues); plot(t,y) end function rk=f(t,y) rk=[y(2); 2500*y(2)-(y(1)/1566416)]; end
@thibautdalemans8601
@thibautdalemans8601 6 жыл бұрын
Hello this video helpen me a lot. y(:,1) is the height and y(:,2) is the velocity. But how do you get the acceleration?
@jakeblanchard
@jakeblanchard 6 жыл бұрын
The original equation is based on the acceleration. So, based on the slide you can see at the 1:44 mark of the video, the accelration is -g+4/15*V^2/m. So once you have the velocities, you can get the acceleration.
@eyeoftheneddle
@eyeoftheneddle 11 жыл бұрын
Hi, I'm trying to solve the exact same problem as you (rocking block motion), have you managed to solve it. I'm struggling with my matlab code too.
@electraravi
@electraravi 11 жыл бұрын
HI, when trying to run i am getting an error saying not enough input arguments at line 2. My code is pasted below function rk= f(t,y) rk=[y(2); 2500*y(2)-(y(1)/1566416)]; timerange=[0 2]; initialvalues=[0 51041666.667]; [t,y]=ode45(@f,timerange, initialvalues); plot(t,y) What could be the problem?
@jakeblanchard
@jakeblanchard 11 жыл бұрын
If you have data for i and you need di/dt, then you need to numerically differentiate the data. Google "matlab numerical derivative" and you'll find some help on this. I'm guessing they'll suggest that you use the diff command.
@ashishgandhi8650
@ashishgandhi8650 12 жыл бұрын
i want to ask you that the above prob is solved by runge kutta or by is it shooting method only..?? plus can "funtion rk" is syntax or is we can use any other substitutes also like "funtion dydx" ?
@blink182doesnotdie
@blink182doesnotdie 7 жыл бұрын
i have an ode 2.order with 2 variables which are both depending on time. how does the rk vector look like? (x1dot,x2dot,x1dotdot, x2dotdot)?? and the dotdot's i got by solving the 2 ode's, so they are then only depending on the dot's und x1 and x2
@jakeblanchard
@jakeblanchard 7 жыл бұрын
If you look at the code presented here, the function defining the equations is written function rk=f(t,y) So you can use time in any way needed as you set up the equations. If this is still not clear, send me a script and I can help.
@blink182doesnotdie
@blink182doesnotdie 7 жыл бұрын
thanks for the fast answer! is it right that i get a system with 4 ode's of first order? so it isnt important for the ode45 in which rows the equatons are? I'm new on Matlab, sorry
@jakeblanchard
@jakeblanchard 7 жыл бұрын
Yes, if you have two second order equations you'll end up with, in general, 4 coupled first order equations. The order of the equations has to be consistent with the order of the 4 variables.
@zoro19840
@zoro19840 15 жыл бұрын
I treied it, it doesnt work , how you run this ? you create 2 .m files ? where you saved them what ar ethe names ? coul you please answer
@medagmedhin3509
@medagmedhin3509 8 жыл бұрын
was the equation like md^2y/dt^2 = -mg+4/15(dy/dt)^2 in the first place. i mean does the v^2 = (dy/dt)^2.
@jakeblanchard
@jakeblanchard 8 жыл бұрын
+meda g/medhin Yes, I used V=dy/dt.
@KlaasBaas
@KlaasBaas 8 жыл бұрын
How would I solve a second order equation of the form y''+y=0 with ode45?
@jakeblanchard
@jakeblanchard 8 жыл бұрын
+Klaas Baas Just follow the procedure in the video. The equations are very similar.
@KlaasBaas
@KlaasBaas 8 жыл бұрын
+Jake Blanchard I can't replace y' with z, because I'm working with just y'' and y.
@jakeblanchard
@jakeblanchard 8 жыл бұрын
+Klaas Baas That just means that you won't use z explicitly in your function that defines the differential equations.
@manzoorayesha8025
@manzoorayesha8025 11 жыл бұрын
Sir, How to identify the given ODE is stiff or non-stiff ODE. Please explain the meaning of PECE SOLVER
@mchauhan4
@mchauhan4 7 жыл бұрын
when I start the code with defining the function rk, it shows an error : 'Function definitions are not permitted in this context.' Please help..!! Do we have to declare the variables t and y in the beginning somehow? If yes, then I dont' know how to define the vector y.. please help..
@jakeblanchard
@jakeblanchard 7 жыл бұрын
You can't put a function in the same file as a main script, unless the main script is also a function. To see an example, go to blanchard.ep.wisc.edu/PublicMatlab/#IVP and download one of the sample files.
@danielsissa
@danielsissa 11 жыл бұрын
what if i want to graph the velocity vs time? is there a way to do it?
@jakeblanchard
@jakeblanchard 11 жыл бұрын
Just use plot(t,y(:,2)) y(:,2) gives all the values of the second variable which, in this case, is the first derivative of y.
@alpha9822
@alpha9822 9 жыл бұрын
I am recieving message as 't' as undefined parameter. What should I do Jake ?
@jakeblanchard
@jakeblanchard 9 жыл бұрын
Rajnish Singh I can't tell without seeing your code. Send me a script file. blanchard@engr.wisc.edu
@kvera1891
@kvera1891 11 жыл бұрын
what do i do if one of my initial values is at a given value. so instead of x(0)=0 I have x'(1)=2
@WorldEditna
@WorldEditna 15 жыл бұрын
hi again. im really lost now with my differential equation (d2i/dt2)=(sin(w*t)/(L*C*Rs))-(di/dt)/(L*Rs)-i/(L*C). i need to solve it with Eulers method and i dont understand what should i enter to matlab to solve.
@alpha001ful
@alpha001ful 13 жыл бұрын
How can define " a function that defines the functions derived on previous slide (the first deivatives of Z and Y)". i think it is not shown here and that is my problem.
@davidwooding
@davidwooding 14 жыл бұрын
@jakeblanchard thank you so much for all your help it was really appreciated :)
@alpha001ful
@alpha001ful 13 жыл бұрын
I tried to do the same simulation for a simple pendulum. Instead of y there , i had angle or variable called theta. Whenever i tried to run, Matlab always said "??? Input argument "theta" is undefined."........i have done exactly the same as here...
@AdiJ8
@AdiJ8 8 жыл бұрын
How would you solve such a problem if the initial condition isn't at zero? For example, instead of y(0) = 600 it is y(4) = 600
@jakeblanchard
@jakeblanchard 8 жыл бұрын
+Aditya Jhanwar I've never done this, but I'm pretty sure you can just have the tspan variable start at t=4. To use the terminology in the video, you would do something like this: timerange=[4 15];
@AdiJ8
@AdiJ8 8 жыл бұрын
Great, makes sense. Thanks!
@gondar3721
@gondar3721 11 жыл бұрын
how to solve the differential equation such as : dx/dt = ax+by+cz where a b and c values are all provided.
@jakeblanchard
@jakeblanchard 12 жыл бұрын
No. If y(1)=y and y(2)=z, then dy/dt comes first and dz/dt comes second.
@jakeblanchard
@jakeblanchard 11 жыл бұрын
I'll try again with spaces: function testit() timerange=[0 2]; initialvalues=[0 51041666.667]; [t,y]=ode45(@f,timerange, initialvalues); plot(t,y) end function rk=f(t,y) rk=[y(2); 2500*y(2)-(y(1)/1566416)]; end
@hasnisafwen6976
@hasnisafwen6976 8 жыл бұрын
(prog of a low pass filter please help me to find the mistake) clear all tau=1; tdebut=0; tfin=10; n=1000; te=(tfin-tdebut)/n; T=[tdebut:te:tfin]; E=[ones(1,1000)]; S(1)=0; for k= 1:n S(k+1)=((1-te)*S(k))+(te*E(k)) ; end plot(T,S(k));
@paul5114
@paul5114 16 жыл бұрын
Great video man! It really helped me with part of my coursework, anyway think there could be an error in your code... In the calculations, you put 4/15 as the constant but in the code, you put 4/14...Is that just me missing something?
@emilioparis5026
@emilioparis5026 11 жыл бұрын
I have problem defining the function rk=f(t,y). when runing the code, a errors pups up saying ??? Input argument "y" is undefined. pleasee hellpp
@jakeblanchard
@jakeblanchard 11 жыл бұрын
Send me an email. This will be easier to handle by email. Better yet, send me your script.
@Letlotlo93
@Letlotlo93 10 жыл бұрын
Thanks so much!
@yangsong3582
@yangsong3582 12 жыл бұрын
OMG, can't matlab be as easy to understand as mathematica?
@achillesarmstrong9639
@achillesarmstrong9639 6 жыл бұрын
very helpful. Wow this is 10 years ago's video lol.
@Hudmyq
@Hudmyq 6 жыл бұрын
Hi, Jake, can you please show me how to solve 2 oder differential equation with 2 variables using Matlab ? Thanks
@jakeblanchard
@jakeblanchard 6 жыл бұрын
I'm not sure I understand your question. If you want to solve a single, 2nd order differential equation, then this video explains how to solve it with Matlab. If you have questions, let me know and I can try to help. If you were asking about how to solve two 2nd order equations, then that's a little different, but the approach is the same. You break the equations into two 1st order equations (giving a total of four 1st order equations) and then solve them with the same approach as in the video. All the input and solution vectors will be twice the size.
@Hudmyq
@Hudmyq 6 жыл бұрын
Jake Blanchard thanks for your answer. Can I send my questions to you by email?
@Hudmyq
@Hudmyq 6 жыл бұрын
The problem is somethinglike this : 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
@jakeblanchard
@jakeblanchard 6 жыл бұрын
So, this is as I described. You've got two second order equations. You break these up into four first order equations and then solve that system. You'll need four initial conditions. If you take a shot at a solution and can't get it to work, then send me what you have at blanchard@engr.wisc.edu and I can try to steer you in the right direction.
@Hudmyq
@Hudmyq 6 жыл бұрын
Hey, Jake, I did what you suggested. It works! Thanks so much
@oglow100
@oglow100 12 жыл бұрын
I finished high school just now and i am going to be doing biomedicine next year. I love calculus and i want to continue learning it. Do you guys know any text books that could help me extend from calculus 1 level?
@AvishekKumarDey
@AvishekKumarDey 9 жыл бұрын
pls tell me how can is solve , D2T/D2X=m^2*T-m^2*Ta-g/k, boundary conditions are DT/DX=h/k*(T(0)-Ta) and DT/DX=h/k*(Ta-T(L)) , i use dsove generally to solve the equations. but here i face some problem.....plz help me. i also tried to solve the equation in simulink . but i could not do that
@jakeblanchard
@jakeblanchard 9 жыл бұрын
You are in the wrong place. This is for initial value problems, but you have a boundary value problem. Matlab has a routine called bvp4c for this. I also have a video. Just do a youtube search for "boundary value problems matlab"
@eyadalhazouri9537
@eyadalhazouri9537 8 жыл бұрын
hi Jake , thank you for your helpful video, but i have to write a code of second Order Differential Equations of heat transfer (fourier equation) rho*c* dT/dt= d(k*dT/dx)/dx + d( k* dT/dy)/dy + d( k* dT/dz)/dz + M could you please help me to write the code
@jakeblanchard
@jakeblanchard 8 жыл бұрын
That is not an ordinary differential equation. It is a partial differential equation. If you really need to solve a time dependent equation in 3D, you might want to consider using finite elements.
@eyadalhazouri9537
@eyadalhazouri9537 8 жыл бұрын
yes it is PDE ...sorry actually i want to use FVM but i am confused how should i start to write to code
@jakeblanchard
@jakeblanchard 8 жыл бұрын
That's not a trivial task. It will take some effort. You'll have to start by understanding the algorithms and then trying to write some code.
@eyadalhazouri9537
@eyadalhazouri9537 8 жыл бұрын
ok thanks :)
@WorldEditna
@WorldEditna 15 жыл бұрын
thanks for ur help
@gondar3721
@gondar3721 11 жыл бұрын
very helpful
@kidwhocracked
@kidwhocracked 14 жыл бұрын
Thank you!
@jakeblanchard
@jakeblanchard 11 жыл бұрын
No. This method is numerical. Look at the Symbolic Math Toolbox to see possible analytical solutions.
@QYong-rq6iw
@QYong-rq6iw 7 жыл бұрын
Could anyone enlighten me on why we have to use (:,1) when we plot t,y ? I have tried with (:,2) or just without (:,1), it seems that there is another curve, but why is that?
@jakeblanchard
@jakeblanchard 7 жыл бұрын
(:,1) asks for all the rows in column 1 of an array. (:,2) asks for column 2. In this case, column 1 holds all the results for the first variable (the position, in the example shown) and the second column holds the second variable (the time derivative of the position, or the speed, in this example).
@justdivi5979
@justdivi5979 10 жыл бұрын
can u pls help me how to solve reynolds equation in matlab i m unable to it.
@jakeblanchard
@jakeblanchard 10 жыл бұрын
I'm afraid I've never solved that equation before.
@justdivi5979
@justdivi5979 10 жыл бұрын
sir could u pls help me in that i m finding difficulty in that
@jakeblanchard
@jakeblanchard 10 жыл бұрын
divya tiwari You can send me what you've done and I can take a look. Email is better.
@justdivi5979
@justdivi5979 10 жыл бұрын
sure i ll
@WorldEditna
@WorldEditna 15 жыл бұрын
Hi! can u help me to solve a second differantial equation based on LC circuit, using matlab, here it is : d^2(I)/dt^2={-1/sqrt(L*C)}*I. thanks
@jakeblanchard
@jakeblanchard 12 жыл бұрын
Actually, it does. You can email me if you need help.
@michaelmatheson2279
@michaelmatheson2279 9 жыл бұрын
so the paratrooper landed ok? Thanks for the post.
@joshhyyym
@joshhyyym 9 жыл бұрын
+michael matheson No he dies he hits the ground at about 54 m/sec.
@frankbrown7043
@frankbrown7043 2 жыл бұрын
I can not resist. I am ex-paratrooper from the US ARMY 82nd Airborne Division. I am also a Chemical Engineer. Most jump are from an altitude of 1250 ft or there abouts. The idea is to be low enough without being a target for defenders. The just recently superseded T-10 parachute had a landing speed, er velocity of approximately 22 feet per second. If you do the calculation; it is like jumping off a 4 foot platform. Sorry the new T-11 chute came out after I was discharged.
@lolochick101
@lolochick101 12 жыл бұрын
Thank you for the help I have sent an email further describing my situation.
@hanchuwang7894
@hanchuwang7894 9 жыл бұрын
I typed the same code was showed in video in matlab, but matlab keeps showing me 'error' T^T
@jakeblanchard
@jakeblanchard 9 жыл бұрын
Hanchu Wang Try going here blanchard.ep.wisc.edu/PublicMatlab/index.html#IVP and downloading some working scripts. OR just email me at blanchard@engr.wisc.edu
@pmd07ptu
@pmd07ptu 10 жыл бұрын
Really sorry about this but MATLAB is causing me a right pain at the moment. I'm trying to compare the exact solution to the numerical solution and have added some code in underneath %Solves analytically. This works as a standalone but the issue is with the syms function and the fact that it is a symbolic variable. I get an error using assignin. function myode3. If you could help that would be great. Many thanks %Time range T=[0 10] %Initial conditions u=[1 2] %Solve numerically function rhs=myode3(t,u) rhs=[u(2);u(1)*3-u(2)*5] end %Solve analytically syms ('y(x)') Dy=diff(y) u_exact=dsolve(diff(y,2)+5*diff(y,1)-3*y,y(0)==1,Dy(0)==2) ezplot(u_exact,[0 10]) % Plots approximate [t,u]=ode45(@myode3,T,u) plot(t,u(1:length(u),1)) end
@jakeblanchard
@jakeblanchard 10 жыл бұрын
I don't use syms. I can't really help you.
@vladimirhatter4959
@vladimirhatter4959 10 жыл бұрын
Your initial conditions "u" can't be the same as output "u"
@tomtomtramp
@tomtomtramp 13 жыл бұрын
I've been using your videos, thanks!. But, I think I'm writing the wrong code. I am developing a system to analysis the rocking motion of a block subjected to an earthquake excitation. The state vector is y(t)={theta(t) , theta'(t)}. and the Time-derivative vector f(t) is y'(t)= {theta'(t) , p^2(sin(alpha*sgn[theta(t)]-theta(t))+u''/g*cos(alpha*sgn[theta(t)]-theta(t))]}. I have the values for p, alpha, u'' and g. But I need theta(t), and theta'(t). Can anyone help, I really need it!
@sandis5059
@sandis5059 7 жыл бұрын
Tom O' Boyle no one get us how to solve Bvp with euler and secant or newtons method ... so this bad....🤔🤔
@davidwooding
@davidwooding 14 жыл бұрын
please please please help me as everyone in my class it stuck on this question as it makes no sense to us. Part (3) Integrating p'' + 0.1536*p' + k^2*p = 0 with intial conditions p(0)=0, p'(0)=1, plot p(L,k) as a function of k.
@jakeblanchard
@jakeblanchard 11 жыл бұрын
I'm afraid I've never heard of the LMI.
@pmd07ptu
@pmd07ptu 10 жыл бұрын
Hi, very clear video. I was wondering whether you would be able to help me with my code. I understand the maths and logic but something subtle is going on which I can't quite figure out (this is just a practise problem) Here is my code function myode clf clear all close all %initial conditions %y(0)=1,y'(0)=z(0)=2 y_0=[1 2] %time period T=[1 10] %solve y''+5y'-3y=0 %y'=z %z'=3y-5z %y(y,z) function rhs=myode(t,y) rhs=[y(2),3*y(1)-5*y(2)] end %Solve ode [t,y]=ode45(@ode,T,y_0) plot(t,y(1)) end I get multiple errors come up which is strange because I have copied the format of this code from a professors code! Usually get 'Not enough inputs' or 'Not enough parenthesis...'. I've saved it as myode.m if that is significant Any help would be great!!! Jack
@jakeblanchard
@jakeblanchard 10 жыл бұрын
There are a few issues here. First, you use myode twice. In the first line, use something like function myodemain Then, your function that defines the ODE is called myode, but you try to send a function called ode to the ode45 routine. Try using [t,y]=ode45(@myode,T,y_0) It still won't work because there is a punctuation problem in myode. Fix that and you should start getting answers. You'll have to decide if they're correct or not.
@pmd07ptu
@pmd07ptu 10 жыл бұрын
Thanks very much, I spotted the issue soon after and got it sorted.
@Billandri
@Billandri 9 жыл бұрын
Thank you
@jakeblanchard
@jakeblanchard 11 жыл бұрын
Yes, that is true.
Solving Boundary Value Problems in MATLAB
11:37
Laplace Academy
Рет қаралды 11 М.
Cool Parenting Gadget Against Mosquitos! 🦟👶 #gen
00:21
TheSoul Music Family
Рет қаралды 33 МЛН
Try Not To Laugh 😅 the Best of BoxtoxTv 👌
00:18
boxtoxtv
Рет қаралды 6 МЛН
Mom had to stand up for the whole family!❤️😍😁
00:39
Solving 2nd order ODE using MATLAB | Course Demo
11:17
Skill Lync
Рет қаралды 29 М.
Lec13 Solving ODEs using ode45 in Matlab
40:37
Jose Gutierrez
Рет қаралды 47 М.
Overview of Differential Equations
14:04
MIT OpenCourseWare
Рет қаралды 600 М.
Numerically Solve Differential Equations in MATLAB | #ode45 examples
10:01
Solve First Order Ordinary Differential Equation in MATLAB using ode45
6:07
ME 340: Example, Solving ODEs using MATLAB's ode45 command
7:15
CPPMechEngTutorials
Рет қаралды 266 М.
What exactly is e?  Exploring e in 5 Levels of Complexity
13:34
Differential equations, a tourist's guide | DE1
27:16
3Blue1Brown
Рет қаралды 4,1 МЛН
Using Simulink to Solve Ordinary Differential Equations - Part 1
7:07
Solve Differential Equations in MATLAB and Simulink
21:06
APMonitor.com
Рет қаралды 405 М.