Dr. Blanchard, Your tutorials are very clear and ideal for beginners but at the same time crucial for advanced users. Please keep posting more of these as this is very noble way of spreading knowledge in addition to your university stage. God bless you. Thanks a lot
Thanks! My professor did a very poor job at explaining ODE's, spent 2 weeks and learned nothing. I spent 7 minutes watching this, took some notes and I have a much better understanding of them. I can even makes some sense of my professor's slides.
I think something like this would work. After you run ode45, you could try plot(t,rk(t,y)) I haven't tried this. It may fail because the rk routine was not written expecting vectors for t and y. More likely you would have to write a new version of rk to accommodate this. Or you could write a loop and calculate the acceleration one at a time for each pair of values for t and y.
The mass can be any arbitrary function of t and y. That is one of the beauties of the numerical approaches. It is very easy to put in arbitrary functions for the parameters.
jakeblanchard If you use Firefox, you need to install the following complement: DownloadHelper (there are other options) and when you're watching the video, appears on the screen, an icon at the bottom of the addon where you can download the video at the size you want. Or you can use aTubeCatcher too.
@jakeblanchard If you use Firefox, you need to install the following complement: DownloadHelper (there are other options) and when you're watching the video, appears on the screen, an icon at the bottom of the addon where you can download the video at the size you want. Or you can use aTubeCatcher too.
Dear Jake, I ve been struggling with ode15i. It seems to me it is actually the most general way of solution offered by matlab. I want to create arbitrary nonlinear ODE and to have the solution plotted (I just want to play..). In help, there is only some weissinger function. Could you ever, when you have time, make a video with ode15i for a nonlinear ODE (SOMETHING LIKE (Dy)^2-y*t+sin(y)=0 ) and with plotted solution? I think not only me would appreciate such video for sure! :-)
@jakeblanchard a number does not have units... no one should assume you have 'hidden' the correct units behind the fraction. you should leave it as a variable and explain the number and units [kg/m] as you do with m and g.
Dear Jake, I ve been struggling with ode15s. It seems to me it is actually the most general way of solution offered by matlab. will u tell me how to make a . m file for this.
Hi. you said that "rk" is what "f" returns. I' wondering if there is a way to plot the acceleration ? plot rk agianst time? how do you get rk out of f.m and plot it?
sir even if iam using the exact equation and coding as shown in this video it says input argument ' y ' is undefined . im new to this can u help me sir
Thanks for all your uploads. I am trying to solve an ODE where I want to run it backwards, hence I have the value of the function and its derivative at t-final. How would I use ode45 when I want to run it backwards??
Sonny Skaaning No. You have to make that substitution in your original differential equation. Then tau starts at 0 and moves forward. From there everything is like a typical ODE.
Thanks for all your help This is then how my odefunc look like function dydt = odefunc(t,y) y = [y(1);y(2)]; A = [0 1; 2 1/y(1)] end Then my code for running the ode45 is yend=-3 yendderivative = 0 tspan =[0,100] initialcondition = [yend,yendderivative]; %IC [t,y] = ode45(@odefunc,xspan,initialcondition); plot(t,y(:,1)); So where should I do that change of variables from tau=-t??? I have conditions at t=100 and not t=0 thus I want to run it backwards. Thanks a lot for the help.
Thanks for the vids! But 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). theta(t) is the rotation angle to time, t. Please help, I need it!
I have on ODE with two functions f, g which are both functions of x. I also have the initial condition for these functions. How do I go about solving it on Matlab?
+Pratik Rao Do you mean that you have two first order equations, like df/dt=... and dg/dt=... If so, this is very similar to solving a single second order ODE, so you might take a look at this: th-cam.com/video/fx3bl4oA_0U/w-d-xo.html
+Jake Blanchard Yes. I realised that my Ode had no analytical solution and hence I had to solve it numerically using ode45. I have m'(x) on my LHS and on the RHS, I have m terms as well as another function dia(x) and it's derivative. However, there is (m^2 - 1) term in the denominator and want the code to stop computations starting from m = 1 as that would be a singularity. The other challenge is to plot the solution of the ode upto m = 1. So I used a for statement: for m = 1: Inf (%1 to any other number larger than it ) However, this isn't working and it's carrying on computations at and beyond the singularity.
I am very sorry, when I do this I get this error, ??? Undefined function or variable 'V'. Error in ==> d at 4 rk=-g+((4/15)*(V^2)/mass); what shall I do, and what is the problem, if anyone could help.... pleaseeeee... ))))
Dr. Blanchard,
Your tutorials are very clear and ideal for beginners but at the same time crucial for advanced users. Please keep posting more of these as this is very noble way of spreading knowledge in addition to your university stage.
God bless you.
Thanks a lot
Thanks! My professor did a very poor job at explaining ODE's, spent 2 weeks and learned nothing. I spent 7 minutes watching this, took some notes and I have a much better understanding of them. I can even makes some sense of my professor's slides.
Thank you. That was very helpful. Also, as a former paratrooper studying physics, I like your example.
Clean and clear tutorial. I am new to Matlab and this was so easy to follow. Thank you so much!
the latter method worked. I just add "rk = ....." after ode45, and plot t & rk. Thank you for your help!
I think something like this would work. After you run ode45, you could try
plot(t,rk(t,y))
I haven't tried this. It may fail because the rk routine was not written expecting vectors for t and y. More likely you would have to write a new version of rk to accommodate this. Or you could write a loop and calculate the acceleration one at a time for each pair of values for t and y.
The mass can be any arbitrary function of t and y. That is one of the beauties of the numerical approaches. It is very easy to put in arbitrary functions for the parameters.
Many thanks for putting this video up. Very clear.
Thank you. Helped me a lot before an exam.
jakeblanchard
If you use Firefox, you need to install the following complement: DownloadHelper (there are other options) and when you're watching the video, appears on the screen, an icon at the bottom of the addon where you can download the video at the size you want.
Or you can use aTubeCatcher too.
@jakeblanchard
If you use Firefox, you need to install the following complement: DownloadHelper (there are other options) and when you're watching the video, appears on the screen, an icon at the bottom of the addon where you can download the video at the size you want.
Or you can use aTubeCatcher too.
Thank you VERY MUCH sir for your help, it totaly helped me. God bless you
Dear Jake,
I ve been struggling with ode15i. It seems to me it is actually the most general way of solution offered by matlab. I want to create arbitrary nonlinear ODE and to have the solution plotted (I just want to play..). In help, there is only some weissinger function.
Could you ever, when you have time, make a video with ode15i for a nonlinear ODE (SOMETHING LIKE (Dy)^2-y*t+sin(y)=0 ) and with plotted solution? I think not only me would appreciate such video for sure! :-)
@jakeblanchard a number does not have units... no one should assume you have 'hidden' the correct units behind the fraction. you should leave it as a variable and explain the number and units [kg/m] as you do with m and g.
Hi,
Thank you for the video, it is very helpful :) I have only one question: there is an online and free source for problems to be done in matlab?
Dear Jake,
I ve been struggling with ode15s. It seems to me it is actually the most general way of solution offered by matlab. will u tell me how to make a . m file for this.
Awesome job, thanks for posting.
This is pretty cool, thank you!
let`s say the function has consists of time being squared. so the dy/dt function has a t in it. would ode 45 still work?
Hi. you said that "rk" is what "f" returns. I' wondering if there is a way to plot the acceleration ? plot rk agianst time? how do you get rk out of f.m and plot it?
thanks, it really helps, but i need solve the same problem with variable mass, how i do that?
the units aren't right... it's one thing to say it won't model reality and another to write an equation that doesn't make sense mathematically either.
very useful :) thank you so much.
sir even if iam using the exact equation and coding as shown in this video it says input argument ' y ' is undefined . im new to this can u help me sir
Thanks for all your uploads. I am trying to solve an ODE where I want to run it backwards, hence I have the value of the function and its derivative at t-final. How would I use ode45 when I want to run it backwards??
I tried the following way
initialcondition = [y0,y0deriv];
xspan = xhigh:-2:xlow;
[x,y] = ode45(@odefunc,xspan,initialcondition);
The safest thing to do is to make a substitution like tau=-t and then you can do a forward solution in tau.
so the code would be
initialcondition = [y0,y0deriv];
xspan = xlow:xhigh
xspanminus=-xspan
[x,y] = ode45(@odefunc,xspanminus,initialcondition);???
Sonny Skaaning
No. You have to make that substitution in your original differential equation. Then tau starts at 0 and moves forward. From there everything is like a typical ODE.
Thanks for all your help
This is then how my odefunc look like
function dydt = odefunc(t,y)
y = [y(1);y(2)];
A = [0 1; 2 1/y(1)]
end
Then my code for running the ode45 is
yend=-3
yendderivative = 0
tspan =[0,100]
initialcondition = [yend,yendderivative]; %IC
[t,y] = ode45(@odefunc,xspan,initialcondition);
plot(t,y(:,1));
So where should I do that change of variables from tau=-t??? I have conditions at t=100 and not t=0 thus I want to run it backwards.
Thanks a lot for the help.
Thanks for the vids! But 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). theta(t) is the rotation angle to time, t. Please help, I need it!
life saver!!!!!
Thank you very much!!!
good explanation. Thanks
Thank you ,thank you, thank you
please sir tell me , how to solve first order differntial equation with the help of ode45
I love u man!
goes to uw madison. has to watch a youtube video to understand this. finds out it's by a uw madison professor. lol
I have on ODE with two functions f, g which are both functions of x. I also have the initial condition for these functions. How do I go about solving it on Matlab?
+Pratik Rao
Do you mean that you have two first order equations, like df/dt=... and dg/dt=...
If so, this is very similar to solving a single second order ODE, so you might take a look at this:
th-cam.com/video/fx3bl4oA_0U/w-d-xo.html
+Jake Blanchard Yes. I realised that my Ode had no analytical solution and hence I had to solve it numerically using ode45. I have m'(x) on my LHS and on the RHS, I have m terms as well as another function dia(x) and it's derivative. However, there is (m^2 - 1) term in the denominator and want the code to stop computations starting from m = 1 as that would be a singularity. The other challenge is to plot the solution of the ode upto m = 1. So I used a for statement:
for m = 1: Inf (%1 to any other number larger than it )
However, this isn't working and it's carrying on computations at and beyond the singularity.
+No
Write out all the equations and send them to blanchard@engr.wisc.edu and I can take a look at them.
Sorry, can anyone plz tell, me do I have to put END in the end??? Thank u!!!!!!!!!!!
nice video, thanks
I am very sorry, when I do this I get this error, ??? Undefined function or variable 'V'.
Error in ==> d at 4
rk=-g+((4/15)*(V^2)/mass);
what shall I do, and what is the problem, if anyone could help.... pleaseeeee... ))))
Thanks dude.
Morgan Freeman !
merci bcp
svp comment peux modéliser les modèles épidémiologies sirs avec matlab
Kechiti Khaoula
Sorry, I don't speak French and the Google translation was difficult to follow.
sorry,
please how can I model the epidemiologies models (s-i-r-s with matlab)
Kechiti Khaoula
You'll have to tell me more about those models. I don't know anything about them.
Thanks....!
nice
its a good v deo
I can try to help. Send me what you have so far and I can look at it.
execuse me sir ... please how to fix this
Error using ==> load
Unable to read file templates: No such file or directory.
It's hard to say. I would have to see your script. Are you using global variables? That may be the root of the problem.
aaaa... ok... thank you very much!!! I get this now.. I am stupid.. sorry!!!
I've never used ode15i. Sorry.
jake
"y" instead of "v" again? Really?
Anyone else think this guy sounds like Al Franken?