QuestionQuestion

Transcribed TextTranscribed Text

1. The Taylor series for sin x is sin x = x − x3 3! + x5 5! − x7 7! + ··· . Plot P3(x) = x − x3 3! and P5(x) = x − x3 3! + x5 5! on the same graph on [−5, 5] range. Graph should be in different colors and also include title, x-label, y-label, and legend.(see MATLAB notes on Isidore) 2. Since f′ (x0) ≈ f(x0 + h) − f(x0) h . Consider f(x) = sin x, x0 = 1.2,fp = cos(1.2), hence cos(x0) ≈ sin(x0 + h) − f(x0) h . Use MATLAB to construct a table of values of difference quotient with decreasing h values. We hope that with decreasing h the error will become smaller and smaller. After completing table what do you notice? Explain. h Absolute error 0.1 0.01 0.001 1e − 4 1e − 5 1e − 6 1e − 7 1e − 8 1e − 9 1e − 10 1e − 11 1e − 13 1e − 15 1e − 16 3 Use Matlab to • Type the following script and run it to get a plot. The plot shows the random nature of roundoff error. t=0:0.002:1; tt=exp(-t).*(sin(2*pi*t)+2); rt=single(tt) round_err=(tt-rt)./tt; plot(t,round_err,’-b’); title(’error in sampling exp(-t)(sin(2\pi t)+2) single precision’) xlabel(’t’) ylabel(’roundoff error’) %relative error is about eps(single)/2 rel_round_err=max(abs(round_err))/(eps(’single’)/2)

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.

%Question 1
x=-5:0.1:5;%increments of 0.1
P3=x-x.^3/factorial(3);
P5=x-x.^3/factorial(3)+x.^5/factorial(5);
figure(1);
plot(x,P3,x,P5);
xlabel('x');
ylabel('y');
legend('P3','P5');...
$35.00 for this solution

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

Find A Tutor

View available Numerical Analysis 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