Apply the finite difference

11 vues (au cours des 30 derniers jours)
Ahmad Faisal Sabaruddin
Ahmad Faisal Sabaruddin le 14 Juil 2020
Réponse apportée : KSSV le 14 Juil 2020
How to apply the finite difference to the following equation of y(t); 𝑑𝑦/𝑑𝑡 = 2𝑦^3 + 5. Given at t=0, y=1. Take time steps at Δt=0.001 and step the solution forward to t=0.25 ?

Réponse acceptée

KSSV
KSSV le 14 Juil 2020
  1. Replace dy/dt with (y(t+1)-y(t))/dt
  2. Simplify it so that y(t+1) is on LHS and rest all on RHS. You will get a equation, RHS has all known values and LHS is the value which we seek.
  3. Initliaze the required arrays and first value of y i.e y = 1 at t=0;
  4. Create time array with specified time step. t = 0:0.001:0.25.
  5. Run a loop using time.

Plus de réponses (0)

Catégories

En savoir plus sur Operators and Elementary Operations dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by