Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In Matlab, Write two functions (a) Implicit_Euler and (b) Implicit_Trapezoid, th

ID: 3574040 • Letter: I

Question

In Matlab, Write two functions (a) Implicit_Euler and (b) Implicit_Trapezoid, the functions input should be f(t,y), its patial derivatives, the bounds (a,b) for t, an initial condition, alpha, and a a number of timesteps (N). Combined these should aid the function in solving the Initial Value Problem dy/dt = f(t,y) for a<=t<=b and y(a) = b. It should use a combination of implicit timestepping method and Newton's method to solve W(subscript j +1). The function header should look like function w = function_name (f,fy,a,b,alpha,N) *Matlab Codes only*

Explanation / Answer

Here I am givin the implemantation for Euler Function.

1) save the below code with .m extension

plot(t,y)

2) Now on matlab gui it will ask for the input and provide the input it will answer and you can plot the plot the graph also.

Here i am giving the code for Implicit_Trapezoid,

1) You can save this file as .m extension and run on matlab tool.

2) It will ask for the input give the inputs and it will return the results and you can also plot the graph also using this matlab tool.

I tested both code in my machine it is working fine.

%function t=t(n,t0,t1,y0) function y=y(n,t0,t1,y0) h=(t1-t0)/n; t(1)=t0; y(1)=y0; for i=1:n t(i+1)=t(i)+h; y(i+1)=y(i)+h*ex(t(i),y(i)); end; V=[t',y']

plot(t,y)

2) Now on matlab gui it will ask for the input and provide the input it will answer and you can plot the plot the graph also.

Here i am giving the code for Implicit_Trapezoid,

1) You can save this file as .m extension and run on matlab tool.

  %Number of points to use  N = 4;  %Integration interval  a = 0;  b = 0.5;  %Width of the integration segments  h = (b-a) / N;  x = 1:1:N-1;  F = h/2*(exp(a) + sum(2*exp(a+x*h)) + exp(b));  

2) It will ask for the input give the inputs and it will return the results and you can also plot the graph also using this matlab tool.

I tested both code in my machine it is working fine.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote