Question create a function using the last 3 digits mnk of your university… create a function using the last 3 digits mnk of your university identification number where the function is f(t) = 2e?t/(11)(cos(t)+sin(t)). Given t0 = 0, t1 = 1, t2 = 2, t3 = 12, you will find and plot spline quadratic interpolation using MATLAB if you just follow the steps. Create an array by using the code below_t=0:0.1:12 f=inline(‘2*exp(-t/12).*(cos(t)+sin(t))’,’t’)You will find three interpolation functions namely, f1(t) = a1t2 + b1t + c1, f2(t) = a2t2 + b2t + c2 and f3(t) = a3t2 + b3t + c3. We have to calculate appropriate ai, bi, ci values for i=1,2,3.We will find wi, yi, xi and zi are numbers in our equations that we will use later.First we will simply use t and f(t) values to derive equations. Between t0 =0 and t1 =1 we have f1(t)=a1t2+b1t+c1. By using 0 and 1 values inside the function, write down two equations in the shape of w1a1 + x1b1 + y1c1 = z1 and w2a1 + x2b1 + y2c1 = z2. For zi use f(t) and corresponding t value. Between t1 =1 and t2 =2 we have f2(t)=a2 t2 + b2 t+ c2 ,write down two equations in the shape of w3a2 +x3b2 +y3c2 = z3 and w4a2 +x4b2 +y4c2 = z4. For zi use f(t) and corresponding t value. Between t2 =2 and t3 =12 we have f3(t)=a3t2+b3t+c3, write down two equations in the shape of w5a3 +x5b3 +y5c3 = z5 and w6a3 +x6b3 +y6c3 = z6. For zi use f(t) and corresponding t value. Now, you have 6 equations for 9 variables.You will use the behavior that mid points have same derivatives from left and right side. For t1, f1?(t1) = f2?(t1). That is 2a1t1 +b1 = 2a2t1 +b2. Write this as w7a1 +x7b1 +y7a2 +z7b2 = 0. For t2, f2?(t2) = f3?(t2). That is 2a2t2 +b2 = 2a3t2 +b3. Write this as w8a2 +x8b2 +y8a3 +z8b3 = 0. Now you have 2 more equations with total 8 equations for 9 variables.To find a unique solution for all f1(t), f2(t) and f3(t) we will assume that f1(t) is a linear function as opposed to being a quadratic function. This makes a1 = 0, and we can treat this equation as 9th equation.1We will solve Ap = l system of equations where p=[a1 b1 c1 a2 b2 c2 a3 b3 c3]T is a column vector. Using MATLAB initialize matrix A as belowA=zeros(9,9)Copy-paste the code below but change the variables with numbers you have found in your equations. When you change numbers don’t forget to keep spaces between them. For example, if you put in MATLAB A(2,:)=[111000000] instead of A(2,:)=[111000000] you will get an error because the first array has 8 elements with the first number being 11.A(1,:)=[w1 x1 y1 0 0 0 0 0 0] A(2,:)=[w2 x2 y2 0 0 0 0 0 0] A(3,:)=[0 0 0 w3 x3 y3 0 0 0] A(4,:)=[0 0 0 w4 x4 y4 0 0 0] A(5,:)=[0 0 0 0 0 0 w5 x5 y5] A(6,:)=[0 0 0 0 0 0 w6 x6 y6] A(7,:)=[w7 x7 0 y7 z7 0 0 0 0] A(8,:)=[0 0 0 w8 x8 0 y8 z8 0] A(9,:)=[1 0 0 0 0 0 0 0 0]After last update on your A matrix, take a screenshot to add it to your homework. Above each line of code changes the rows of A which are corresponding to the equations you have derived. Now you create l column vector by putting your own numbers inside.l=[z1 z2 z3 z4 z5 z6 0 0 0]’Solve p by p=AlNow, you will copy-paste some terribly inefficient codes your instructor wrote for you.t1=[ones(1,11) zeros(1,110)].*t;t10=[ones(1,11) zeros(1,110)];t12=[ones(1,11) zeros(1,110)].*t.^2;t2=[zeros(1,11) ones(1,10*(k+1)) zeros(1,10*(10-k))].*t; t20=[zeros(1,11) ones(1,10*(k+1)) zeros(1,10*(10-k))]; t22=[zeros(1,11) ones(1,10*(k+1)) zeros(1,10*(10-k))].*t.^2; t3=[zeros(1,11) zeros(1,10*(k+1)) ones(1,10*(10-k))].*t; t30=[zeros(1,11) zeros(1,10*(k+1)) ones(1,10*(10-k))]; t32=[zeros(1,11) zeros(1,10*(k+1)) ones(1,10*(10-k))].*t.^2;Let’s compute spline interpolation at last.spline=[t12;t1;t10;t22;t2;t20;t32;t3;t30]’*p;Let’s draw your f(t) (blue) and spline (red) on top of each other. Obviously, blue and red curves intersect at t0, t1, t2, t3 values.figureplot(t,f(t),’b’)hold plot(t,spline,’r’)What I want to see in your submission: The 8 equations you have derived, matrix A, l vector, p vector and the graph you have gotten at the end. DO NOT PUT ANYTHING ELSE ON YOUR SUBMISSION. Math Statistics and Probability matlab CIVIL ENGI MATH300 Share QuestionEmailCopy link Comments (0)