Hi, im trying to plot a first ODE, but dont know how to do it. Can somebody help me. Here is the code so far:

3 views (last 30 days)
syms a1 a2 a3 ny E tau sigma_c r l delta_phi x(t)
a1 = (E/(2*(1+ny)))*(r/l)*delta_phi;
a2 = (1+ny)/E;
a3 = (9*sqrt(3))/(2*tau*sigma_c)^4;
x(t) = dsolve(diff(x,t) == -(a3/a2)*(x)^4, x(0) == a1)
% Plot t_half and a1 as a function of r
r=0:0.01:1;
t_half = (7*a2)/(3*a1^3*a3)
ezplot(t_half,r)
  1 Comment
Walter Roberson
Walter Roberson on 20 Nov 2016
Where is the x in what you want to plot? Where do you give specific values to E, delta_phi, l, ny, r, sigma_c, t, and tau such that you might hope to be able to plot?

Sign in to comment.

Accepted Answer

Sebastian Kammer
Sebastian Kammer on 23 Nov 2016
As Walter has suggested, it might be helpful to assign numerical values to your symbolic parameters before using the "dsolve" function.
Currently it seems that "dsolve" is returning multiple solutions to the equation, which is likely caused by the uncertainties associated with all the different symbolic variables.
For instance, if you specify a constant number instead of your parametric initial condition, you will see that "dsolve" returns a unique solution in terms of "t" and your other parameters.
Once you have a solution in this form, you could simply substitute numerical values instead of your symbolic parameters and end up with an explicit solution of "x" in terms of "t".
You could then plot "x" versus "t" using functions such as "subs" or "eval".

More Answers (0)

Community Treasure Hunt

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

Start Hunting!