MATLAB (1st order differential equation)

Thread Starter

karas

Joined Sep 8, 2011
211
hi , i am trying to solve differential equation by matlab and i get these
syms p(t) k p0 p15
>> p = dsolve('Dp=k*p*exp(450/p)','p(0)=40,p(15)=95','t')
Warning: Unable to find explicit solution.
> In dsolve (line 201)

and also i did this
>> syms y(t) k
ode = (diff(y,t) == k*y*exp(450/y));
cond =[ y(0) == 40, y(15) == 95];
ySol(t) = dsolve(ode,cond)
Warning: Unable to find explicit solution.
> In dsolve (line 201)

my function is
Dp=kp ln(450/p)
p(0)=40 and p(15)=95 , k is constant
can someone help please, i am new to MATLAB
 
Last edited:

Thread Starter

karas

Joined Sep 8, 2011
211
... suggest getting the sample problem in the following link to work, then modify as needed.:
https://www.mathworks.com/help/symbolic/dsolve.html
Thanks for your help, i did follow the instruction and i still get this warning
syms y(t) a
eqn = diff(y,t) == a*y*exp(450/y);
cond = [y(0)==40, y(15)==95];
ySol(t) = dsolve(eqn,cond)
Warning: Unable to find explicit solution.
> In dsolve (line 201)
 

Thread Starter

karas

Joined Sep 8, 2011
211
i have to use ode45 but the solution is not right , so what is wrong(i have 2 initial conditions and one constant k , did i write these initial condition and constant right in MATLAB?
tspan = [0 300];
y0 = 40;y15=95;
[t,y] = ode45(@(t,y) 'k'*y*exp(450/y), tspan, y0,y15);
plot(t,y,'-o')
 

drc_567

Joined Dec 29, 2008
1,156
One thing to test or try out ...
If you are able to take the derivative of your first order original equation, that should yield a second order differential equation, which may be more acceptable to Matlab.
If so far, you have all the syntax correct, then maybe that would be something to try.
 
Top