Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

xleft=-2; xright=2; N=20; x=linspace(xleft,xright,N); x=x'; dx=(xright-xleft)/(N-1); yleft=-1; yright=0; M=(diag(-2*ones(N,1),0)+diag(ones(N-1,1),-1)+diag(ones(N-1,1),1))/dx^2; M(1,:)=[1,zeros(1,N-1)]; M(end,:)=[zeros(1,N-1),1]; b=exp(cos(x))-exp(sin(x)); b(1)=yleft; b(end)=yright; y=Mb; plot(xleft:dx:xright,y) i got the answer 3.962 from this and its

image text in transcribed

xleft=-2;

xright=2;

N=20;

x=linspace(xleft,xright,N);

x=x';

dx=(xright-xleft)/(N-1);

yleft=-1;

yright=0;

M=(diag(-2*ones(N,1),0)+diag(ones(N-1,1),-1)+diag(ones(N-1,1),1))/dx^2;

M(1,:)=[1,zeros(1,N-1)];

M(end,:)=[zeros(1,N-1),1];

b=exp(cos(x))-exp(sin(x));

b(1)=yleft;

b(end)=yright;

y=M\b;

plot(xleft:dx:xright,y)

i got the answer 3.962 from this and its wrong. please correct this. thankyou.

The code provided solves the boundary value problem - = x cos(x), y(1) = 1, y(5) = 2 , on the interval 2 , on the interval d.c2 1

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

Development Of Integrated Reporting In The SME SectorCase Studies From European Countries

Authors: Joanna Dyczkowska, Andrea Szirmai Madarasine, Adriana Tiron-Tudor

1st Edition

3030819027, 9783030819026

More Books

Students also viewed these Accounting questions