QuestionQuestion

Transcribed TextTranscribed Text

Problem 1 Create a function M-file in MATLAB to solve the system of nonlinear equations (1) using the Newton-Raphson method. x 3−y 2=−1 0.5+ cos( x)tanh( y )=0 There are many solutions. Your code must find all of the real solutions with x lying between 0 and 2pi and y being positive. As well as the usual requirements of function M-files you will need to pay particular attention to termination conditions. Problem 2 Create a function M-file in MATLAB to solve an arbitrary system of linear equations by Gaussian elimination with partial pivoting. Apply the resulting M-file to solve the system of linear equations (2). Is it possible to solve this system using Gaussian elimination without pivoting? Check your results by re-solving the equations using built-in MATLAB commands. The section on matrices in experiment MS0_1 offered two ways for you to solve a system of linear equations using built-in MATLAB commands. Be aware that in this case, and for obvious reasons, the bulk of the marks will be assigned to your MATLAB code implementing the required Gaussian elimination with partial pivoting algorithm. 3.2x2+ x4−0.5x5=0 −2.1x1+ 2.2x2+ 7.5x3−1.9x4+ x5=−2.5 10x1+ 3x2+ 1.2x4+ 5.5x5=−7 2x1+ x2−5.8x3−11x4−x5=6.1 3x1−3x3−4x4+ 11x5=2.6

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

Problem 1:

T=1;
n=100;m=10;
dt=T/n;
xmin=-1; xmax=1;
dx=2/m;
t=0:dt:T; x=-1:dx:1;
U=zeros(m+1,n+1);
U(:,1)=2*x'+1;
U(1,:)=-ones(n+1,1);
U(m+1,:)=3*ones(n+1,1);
alpha=dt/dx^2;
% d1=diag(ones(1,m-1));d2=diag(ones(1,m-2),1)...
%    +diag(ones(1,m-2),-1);
% A=(1+alpha)*d1-0.5*alpha*d2;
% B=(1-alpha)*d1+0.5*alpha*d2;
A=(1+alpha)*diag(ones(1,m-1))-0.5*alpha*diag(ones(1,m-2),1)...
    -0.5*alpha*diag(ones(1,m-2),-1);
B=0.5*alpha*(-2*diag(ones(1,m-1))+diag(ones(1,m-2),1)...
    +diag(ones(1,m-2),-1));
inv(A)
for k=1:n...
$80.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available MATLAB for Mathematics Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats