MATLAB question: Write code for MATLAB that can perform Simpson\'s 3/8 Rule that
ID: 3283193 • Letter: M
Question
MATLAB question: Write code for MATLAB that can perform Simpson's 3/8 Rule that will give answers shown in the work through below
Let the integral equation be given as v(z) x2 + 0.1.10 (x2 + t)v(t) dt. This could, for example, be the expression for the velocity of some object at position x. Note here that t is just a dummy variable used for integration purposes. To solve this integral equation via Simpson's rule with h -0.5, we let to 0,t10.5 and t? -1. We then ave Substituting Eq (1) into the integral equation we then have 0.10.5)1) Substituting ro 0, 0.5, r2-1 into Eq (2) gives us a system of linear equations vi- 0.25 (0.25v0 + 3v1 + 1.2502) 60 60 which can be solved to give vo 0.0273, v1-0.2866, v2 = 1.0646. Substituting these values back into Eq (2) and simplifying the algebra gives us the solution to the integral equation: v(x) 1.037305r2 0.027297 One can check the validity of the solution by substituting it back into the right hand side of the integral equation, integrating and simplifving the right hand side. This should compare well with the approximate solution given by Eq (3). This is a technique known as a self-consistency check and is common throughout applied mathematics, science and engineering. (a) [15 marks] Using the ideas presented above, use the Simpson rule with h 0.5 to approximate the solution of the integral equation given by 1.5 3 v(x) -30.25 a t)v (t) dt 0Explanation / Answer
x=0:0.5:1;%you can change the increment E=0:1/(numel(x)-1):3;%has to be same length with x y= (x^2+t)y; simpson(x,y,[],'3/8')
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.