Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please answer the question of assignment 35..if you need the equation of the assignment 34 its also attached. Please link the Matlap code in the

Please answer the question of assignment 35..if you need the equation of the assignment 34 its also attached. Please link the Matlap code in the answer. Thanks alot image text in transcribed
image text in transcribed
Assignment 35: Euler with Matlab Given is the following header the function Euler: function [t,yl Euler (deriv func, t end, dt, to,yo) Function to approximate a first order DE by the Euler method. s The DE has the form dy/dt f(t,y) Inputs : t deriv func: a Matlab function in which the right hand side of the DE has been programmed. % tend: time until which the DE has to be solved t dt: step size t0: start time y0: initial value of the solution Assignment 6: Numerical Methods for Differential Equations 1/3 % Outputs: t: array with times at which the solution has been calculated % y: array with the values of te numerical approximation One of the inputs needed by the Euler function is the expression f(t, y). This expression needs to be programmed in a separation function file. An example might be 1 function dy righthands ide (t,Y) 3 end Make a Matlab script in which you call the Euler function to solve the DE Calling the Euler function goes like: 1 to0 2 t1-3: 3 dt 0.1: 5 It, yl-Euler (righthandside, t1,dt, to, yo) ; We are now going to solve the DE of the previous exercise by means of Matlab (a) Write a Matiab function righthandside to implement the righthand side of the DE. (b) Write the Euler function itself (c) Write a Matlab script in which you solve the DE until t 0.3. Use start time t 0 and step size dt 0.1 (d) Plot the solution using markers (e.g. circles). Don't draw a connection line through the points of the solution. (d) The analytical solution has been given in the previous assignment. Evaluate this solution at the same time values as the Euler solution. Plot the analytical solution in the same figure, use this time a line and no markers. (e) Determine now the Euler solution for the step sizes 0.05 and 0.01, and plot these in the same figure (f) Finally increase the end time to t-3, take the step size 0.01 and determine the Euler solution. Plot this solution together with the analytical solution in a new figure. Assignment 34: Euler by hand It is good to apply once the Euler method manually with pen and paper. In this way, you will understand the algorithm better (also yqu are going to appreciate the computer more). Given is the following differential equation (DE) and boundary condition (BC): oy - y - 2t, y(0)-1 dt The analytical solution of this DE and BC is y(t)-2t +2-e (a) Show that the given solution, is indeed valid (b) Calculate the value of the numerical solution, by means of the Euler method at 03. Use step size t-0.1. Perform your calculations with a precision of 4 digits after the decimal point. Hint: use a table and work properly. (c) Can you explain if the Euler approximation is higher or lower than the analytical solution? Hint: plot the analytical solution given and sketch the first step of the Euler method. (d) Repeat (b) again, but now with step sizet0.05. Calculate the deviation between the Euler approximation and the analytical solution at t 0.3, for both time steps. (e) Calculate the ratio Error A0.1 Error A0.05

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_2

Step: 3

blur-text-image_3

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2017 Skopje Macedonia September 18 22 2017 Proceedings Part 3 Lnai 10536

Authors: Yasemin Altun ,Kamalika Das ,Taneli Mielikainen ,Donato Malerba ,Jerzy Stefanowski ,Jesse Read ,Marinka Zitnik ,Michelangelo Ceci ,Saso Dzeroski

1st Edition

3319712721, 978-3319712727

More Books

Students also viewed these Databases questions

Question

b. Where did they come from?

Answered: 1 week ago