Home MATLAB Differential Equations IVP select initial value in between range
Reply: 0

MATLAB Differential Equations IVP select initial value in between range

user448
1#
user448 Published in May 27, 2018, 3:37 am

Am using the function ode45 to solve a differential equations with IVP, Is it possible to set the tspan in a range [-5:0.5:5] and use an initial value at the point zero => y(0)= 1.

Am trying to graph the result from start of range to end [-5,5]. this What I have come up with so far

f = @(x, y) sin(y);
y0 = -1.5;
tspan = [-5:0.5:5];
[ts,ys] = ode45(f, tspan, y0); plot(ts, ys);
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.302193 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO