# How do I solve an ODE of the form y'=ay^3 +by^2 +cy +d?

4 views (last 30 days)

Show older comments

I have a vector, for example "pn" of size (20,1). Each point of data describes a coeffecient of y to the power of 20 minus that data point indices (made from the polyfit function in matlab).

For example, pn(15,1) = 5 translates to 5y^5

This defines a large polynomial which looks similar to the title example.

I know that the ODE I have is of the form y'=ay^19 + by^18 +cy^17 +...+gy +h

how can i solve this ode to make a plot of y as a function of t?

I know about the ODE functions like ode45 etc, but I'm not sure how to use them with my ode form.

Thanks!

##### 1 Comment

James Tursa
on 25 Jan 2022

### Accepted Answer

Jon
on 25 Jan 2022

The ode solvers, e.g. ode45 require a function handle which will evaluate the current value of the derivative given the current state. So define your function for example as:

fun = @(y)polyval(pn,y)

##### 0 Comments

### More Answers (1)

### See Also

### Community Treasure Hunt

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

Start Hunting!