Question

Please provide me the maximum computed y vector for the given domain

The colde provided solbe)() 1, y(5).nthe ntred aproimation o 100 no y value prob 1) -1. บู(5) -2, on the interval-rousing a c

0 0
Add a comment Improve this question Transcribed image text
Answer #1

I have implemented the code as required. I have attached the code as well as the screenshot with output.

Code:

clc
xleft = 0.5;
xright = 1.5;
N = 20;
x = linspace(xleft,xright,N);
x = x';
dx = (xright - xleft)/(N-1);
yleft = 1;
yright = 1;
M2 = (diag(-2*ones(N,1),0) + diag(ones(N-1,1),-1)+diag(ones(N-1,1),1))/dx^2;
M1 = (diag(ones(N-1,1),1) - diag(ones(N-1,1),-1))/(2*dx);
M0 = eye(N);
M = 1*M2 + 1*M1 + 3*M0;

b = log(x)./x;
b(1) = yleft;
b(end) = yright;

y = M\b;
fprintf('The maximum value of vector y in this domain is: %.3f\n',max(y));
plot(x,y)
title('y" + y'' + 3*y = log(x) for x = (0.5,1.5)')
xlabel('x')
ylabel('y')

Screenshot:

Editor- DAPrograms MATLAB boundaryValue.m boundaryValue.m x+ clc xleft -0.5 right = 1.5; N-20; xlinspace (xleft, xright,N); F

Add a comment
Know the answer?
Add Answer to:
The colde provided solbe)() 1, y(5).nthe ntred aproimation o 100 no y value prob 1) -1. บู(5) -2,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • The code provided solves the boundary value problem 2 dr2 cos(a), J(1) , y(5)2.on the interval To...

    Please provide code and final answer. The code provided solves the boundary value problem 2 dr2 cos(a), J(1) , y(5)2.on the interval Toxksusing a Centred approximation of the derivative term and N= 100 nodes 1 we% Matlab code for the solution of Module 2 3 xright=5; 4 N 100; 5 x-linspace(xleft,xright,N); x x'; %this just turns x into a column vector dx- 7 (xright-xleft)/(N-1); %If theres N nodes, theres N-1 separations . 9 yright 2; 10 here is the matrix...

  • I know the solution is 0.2, but it says incorrect for my quiz. I think there...

    I know the solution is 0.2, but it says incorrect for my quiz. I think there is a problem when writing log(x). Can someone help me? The code provided solves the boundary value problem dạy %= r- cos(x), y(1) = 1, y(5) = 2 , on the interval 1<x<5 using a d.x2 centred approximation of the derivative term and N=100 nodes. 1 4 x Matlab code for the solution of Module 2 xleft = 1; xright = 5; N =...

  • Use the attached Matlab code as a basis to solve the following ordinary differential equation usi...

    Question 1 QUESTION 2 Use the attached Matlab code as a basis to solve the following ordinary differential equation using Euler's method, with timestep of 0.1, from t-0to t-100. d)0) -0 - sin (5vt cos(у Plot y versus t from t=0 to t=100. How many local maxima are on this interval(do not include end points). Be careful to count them all! Answer should be an integer 1 w% Matlab code for the solution of Module 2 3 dt-9.1; %dt is...

  • on matlab (1) Matrices are entered row-wise. Row commas. Enter 1 2 3 (2) Element A,...

    on matlab (1) Matrices are entered row-wise. Row commas. Enter 1 2 3 (2) Element A, of matrix A is accesser (3) Correcting an entry is easy to (4) Any submatrix of Ais obtained by d row wise. Rows are separated by semicolons and columns are separated by spaces ner A l 23:45 6. B and hit the return/enter kry matrix A is accessed as A Enter and hit the returnerter key an entry is easy through indesine Enter 19...

  • QUESTION: Show= (y − y0* )(y − y1*) . .(y − yn* ) = 5 it...

    QUESTION: Show= (y − y0* )(y − y1*) . .(y − yn* ) = 5 it is Part 1 at the bottom We were unable to transcribe this image(7+17) Problem 1: Recall that the Chebyshev nodes x7, x1,...,x* are determined on the interval (-1,1] [-1, 1) as the zeros of Tn+1(x) = cos((n + 1) arccos(x)) and are given by 2j +12 X; - cos j = 0,1, ... n. n+1 2 Consider now interpolating the function f(x) = 1/(1+x2)...

  • Function LUfac_solver.m is provided here: function [x] = LUfac_solver(LU,b,piv) % % function [x] = LUfac_solver(lu,b) %...

    Function LUfac_solver.m is provided here: function [x] = LUfac_solver(LU,b,piv) % % function [x] = LUfac_solver(lu,b) % % This program employs the LU factorization to solve the linear system Ax=b.   % % Input % LU: lu matrix from GEpivot_new function % b: right side column vector (ordered corresponding to original vector % sent to GEpivot_new) % piv: vector indicating the pivoting (row interchanges that took place % during GE % % Output % x: solution vector % % Written by Steve...

  • I need to create a MATLAB function, bvp_solve.m, to approximate the solution y(x). The function takes...

    I need to create a MATLAB function, bvp_solve.m, to approximate the solution y(x). The function takes the number of grid points n as an input. The outputs are grid vector x and the solution vector y %% This is the function i have so far: function [xi, yi] = bvp_solve(n) % BVP_SOLVE computes the solution y(x) of a two-point boundary value problem % using finite difference method (FDM). % The governing equation is % y''' = -y + (x -...

  • MATLAB %% T = 1; N = 11; np = 2; dt = 0.001; tmax =...

    MATLAB %% T = 1; N = 11; np = 2; dt = 0.001; tmax = np*T; t = -tmax:dt:tmax; %% Function 1 %the following code was used to create the x(t) function xrange = floor((T/dt)/15); x1 = linspace(0,1,xrange); x2 = x1(end-1:-1:1); x3 = linspace(0,2,2*xrange); x4 = x3(end-1:-1:1); x5 = zeros(1,xrange); x6 = x1; x7 = 2*ones(1,xrange); x8 = 1+x2; x9 = -0.5*ones(1,xrange); x10 = x1/2-0.5; xtemp = [x1 x2 x3 x4 x5 x6 x7 x8 x9 x10]; ztemp =...

  • Part I: Show that (y − y ∗ 0 )(y − y ∗ 1 ). ....

    Part I: Show that (y − y ∗ 0 )(y − y ∗ 1 ). . .(y − y ∗ n ) = 5 n+1 2 n Tn+1(x), where x = y/5 Part II: It can be shown that there exists R > 0 such that |f (n) (y)| ≤ Rn for all y ∈ [−5, 5]. Assuming this, show that limn→∞ max{|f(y) − Pn(y)|, y ∈ [−5, 5]} = 0 Ij = COS Problem 1: Recall that the Chebyshev...

  • numerical methods 2+17), j = 0,1...... Problem 1: Recall that the Chebyshev nodes x0, 71,..., are...

    numerical methods 2+17), j = 0,1...... Problem 1: Recall that the Chebyshev nodes x0, 71,..., are determined on the interval (-1,1) as the zeros of Tn+1(x) = cos((n +1) arccos(x)) and are given by 2j +17 X; = cos in +12 Consider now interpolating the function f(x) = 1/(1+22) on the interval (-5,5). We have seen in lecture that if equispaced nodes are used, the error grows unbound- edly as more points are used. The purpose of this problem is...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT