Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Matlab help, help take the screenshot of the Matlab code here's the Code Snippet 1 Exercise 4 Now write a function M-file my_euler.m which take

Matlab help, help take the screenshot of the Matlab code

image text in transcribed

here's the Code Snippet 1

image text in transcribed

Exercise 4 Now write a function M-file my_euler.m which take 5 input values, f, t_0, y_0, dt, and t_f that specify the function to be approximated, the initial t-value, the initial condition y(to) = yo, the step-size At, and the final t-value at which you want to approximate the solution y(t). Your function should: Use the input anonymous function f to calculate f(t, y). Plot the approximate solution with green "+" symbols at the points and a red line joining them up. Have a function output giving the numerical value of the approximate solution to y(t) at the final t-value, t_f. Show/hide hint Start with the code in Code Snippet 1 and think about how you need to modify it. All variables inside my_euler.m the should be calculated from the input variables so that you can run the function from the Command Window. You will need to upload your M-file during the Module. Show/hide Code Snippet 1 1 2 3 4 5 6 7 8 9 10 11 12 t = zeros (1,10+1); y = zeros (1, 10+1); t(1) 0; y(1) = 1; dt = 0.2; for k = 1:10 t(k+1) = t(k)+dt; y(k+1) y(k)+dt*(1-exp(-4*t(k))-2*y (k)); end plot(t,y,'ro-') t(end) y(end) =

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Managing Your Information How To Design And Create A Textual Database On Your Microcomputer

Authors: Tenopir, Carol, Lundeen, Gerald

1st Edition

1555700233, 9781555700232

More Books

Students also viewed these Databases questions