How do I solve this differential equation with MATLAB?

2 views (last 30 days)
Hi yall!
I'm wondering how to get the solution for "dy/dx = x^2 - 1" in MATLAB using dsolve with initial condition y(0) = 1. I want to know and see all the MATLAB work for when x = 1 and when x = 2. I'm familiar with dsolve but I want to see how to use it correctly. Please help me.

Answers (1)

Walter Roberson
Walter Roberson on 3 Oct 2019
Edited: Walter Roberson on 3 Oct 2019
syms y(x)
dy = diff(y(x),x);
eqn = dy == Some Function Of x and y
sol = dsolve(eqn, y(0) == Initial Condition)
subs(sol, x, Some Value)

Categories

Find more on Mathematics in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!