Clear Filters
Clear Filters

How can i get ODE to solve an equation if my y0 is more than one value?

2 views (last 30 days)
%This is the equation that i have to differentiate using ODE 45. (dt/dx=1/(alpha*x^-2+(beta*x^-3))
I= 0.08
a = 104E-6;
b = 73E-6 ;
alpha = -(density*mo*r^2*m.*I)/(9*pi*visocity);
beta = -(xbead*r^2*m.*I^2)/(18*pi^2*visocity);
equation= 1/(alpha*x^-2+(beta*x^-3));
xspan= [a b]
% the asumption is that a<=x <=b, t(a)=0 and t(b)=equation
% What would my y0 be?
[x,y]= ode45(equation,xspan,?)
Jan on 28 Sep 2022
ODE45 does not differentiate, but integrate.
"t(a)=0 and t(b)=equation" - this is not meaningful. What is t?
Without an initial value, a numerical integration is not meaningful.

Sign in to comment.

Accepted Answer

John D'Errico
John D'Errico on 28 Sep 2022
Edited: John D'Errico on 28 Sep 2022
You seem to have a misunderstanding.
You are asking to solve a differential equation, here a first order ODE. (A Jan points out, this is an INTEGRATION operation, NOT differentiation.) In the end, you would want to compute the functino t(x), over the interval [a,b]. No problems so far. We see the ODE, here:
So a farirly simple ODE. The interval of integration is given as
a = 104E-6;
b = 73E-6 ;
Still no obvious problems, but yet... There would be a problem if the interval of integration included zero, since then you would have a singularity. Mathematics tends to be unhappy with singularities. :)
Anyway, the first problem I see is a > b, yet I see you state: "a<=x <=b". Do you see the problem? a is clearly GREATER THAN b, yet you then wish to integrate over n interval where you then state a<=b. So we have an immediate problem, and a major one. This MIGHT be just a typo. Perhaps you intended to write a=14e-6. I cannot know, as I cannot read your mind.
Ok, I'll assume that you just made a typo there. You still have a major problem.
You have not told usenough information for me to go any further, since we are not told the values of:
density, mo, r, m, visocity(I think you are mispelling viscosity, but what do I know?), xbead
Hey, at least you told us I.
Finally, you then tell us that t(a) = 0, and t(b) is also given. The problem is, a simple first oder ODE has ONE degree of freedom. You can choose a value the curve passes through at one end or the other. But you CANNOT choose TWO points for the curve to pass through.
So at this point, you are stuck, with a major problem of mathematics. You may need to go back and do some reading about differential equations, but you ask to do something that is not possible if all of the unknown parameters I have listed are known.

More Answers (0)


Find more on Programming in Help Center and File Exchange




Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!