Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I am trying to create a code on matlab, I have done the first part of creating a script to solve my ode, but now
I am trying to create a code on matlab, I have done the first part of creating a script to solve my ode, but now I need help with eulers method using the specified parameters above. Thanks!
CHE222 Lab 8 - Tuesday, March 13 Learning Outcomes: After this lab, you should be able to use Euler's method for numerical integration. Prelab - 2 Points: For the arbitrary function calculates and outputs the value of G for any inputted y value. Your function definition should loolk omething like this: ay =-3y + 30, create a new MATLAB function that dt dt function dy = functionname(y,t) Create a new script that uses your created function to implement Euler's method to approximate the value oty over a time period of 0 to 100 seconds. You may assume yo-0 and you may use At-2. The algorithm for Euler's Method is described below. Euler's method: Given an initial value of yo at time to and an expression for the first derivative *- f(t, y), the value of the variable y after a time interval of At, denoted by y1, can be estimated by: dt Eq. 1 Which can be iteratively evaluated to estimate the value of y at each subsequent time step until a specified time tfinal Algorithm (1) Determine the number of required steps n using n - (2) Starting from i = 0, set yi and ti to their initial values of yo and to (3) Calculate the derivative using the function f (ti,yi) (4) Estimate the value of yit1 at time ti + t using: final LO At 2 (5) Calculate the value of ti+1 using tH-t + t and also update the iterator using 1 = 1 + 1. (6) Ifi is less than or equal to n, repeat steps 3-5. Otherwise, stopStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started