ng speed, p | Tool life, T (m/min) (min) 7.0 5.5 200 5.0 220 3.5 240 2.0 Determi
ID: 3779881 • Letter: N
Question
ng speed, p | Tool life, T (m/min) (min) 7.0 5.5 200 5.0 220 3.5 240 2.0 Determine the tool life equation, VT= b, where a and b are constants, using the method of least squares. Problem Lagrange Interpolating Functions (Rao Problems 5.5 and 5.7) Develop a MATLAB function that uses Lagrange Interpolation to estimate a function value at a specified value of the independent variable. The specified independent variable value and a series of known data points are passed as the only function inputs, and the estimated function value is passed back as the only function result. In a separate script file, write a MATLAB script (not a function) that solves the following problems. Your script will create the data arrays and will use your Lagrange function to obtain the answers. A) The amplitude of vibration in the vertical direction of an automobile, after passing over a road bump is found to be as follows (Rao Problem 5.5): Times t (sec) 0 64 1.28 1 1.92 Amplitude, amm) | 0.75 0.3 Estimate the amplitude of motion at t = 2 sec. write the answer here:-- B) A series ofy vs. x data points is given as follows (Rao Problem 5.7): -2 Estimate the value ofy at x =-25. write the answer here: HINT: Your Lagrange function must be designed to use input data series of varying length.Explanation / Answer
2#
A)
SOURCE CODE:
clc;
clear all;
close all;
t=[0 .64 1.28 1.92];
a=[5 2 0.75 0.3];
k=2;
%Applying Lagrange’s Interpolation:
ans1=((k-t(2))*(k-t(3))*(k-t(4)))*a(1)/((t(1)-t(2))*(t(1)-t(3))*(t(1)-t(4)));
ans2=((k-t(1))*(k-t(3))*(k-t(4)))*a(2)/((t(2)-t(1))*(t(2)-t(3))*(t(2)-t(4)));
ans3=((k-t(1))*(k-t(2))*(k-t(4)))*a(3)/((t(3)-t(1))*(t(3)-t(2))*(t(3)-t(4)));
ans4=((k-t(1))*(k-t(2))*(k-t(3)))*a(4)/((t(4)-t(1))*(t(4)-t(2))*(t(4)-t(3)));
m=ans1+ans2+ans3+ans4;
t
a
formatSpec = 'The value of a corresponding to t=2 is %f ';
fprintf(formatSpec,m)
SAMPLE OUTPUT:
t =
0 0.6400 1.2800 1.9200
a =
5.0000 2.0000 0.7500 0.3000
The value of a corresponding to t=2 is 0.252686
B)
SOURCE CODE:
clc;
clear all;
close all;
x=[-4 -3 -2 -1 0]; %Change here for different function
y=[5 0 3 2 9];
a=-2.5;
%Applying Lagrange’s Interpolation:
ans1=((a-x(2))*(a-x(3))*(a-x(4))*(a-x(5)))*y(1)/((x(1)-x(2))*(x(1)-x(3))*(x(1)-x(4))*(x(1)-x(5)));
ans2=((a-x(1))*(a-x(3))*(a-x(4))*(a-x(5)))*y(2)/((x(2)-x(1))*(x(2)-x(3))*(x(2)-x(4))*(x(2)-x(5)));
ans3=((a-x(1))*(a-x(2))*(a-x(4))*(a-x(5)))*y(3)/((x(3)-x(1))*(x(3)-x(2))*(x(3)-x(4))*(x(3)-x(5)));
ans4=((a-x(1))*(a-x(2))*(a-x(3))*(a-x(5)))*y(4)/((x(4)-x(1))*(x(4)-x(2))*(x(4)-x(3))*(x(4)-x(5)));
ans5=((a-x(1))*(a-x(2))*(a-x(3))*(a-x(4)))*y(5)/((x(5)-x(1))*(x(5)-x(2))*(x(5)-x(3))*(x(5)-x(4)));
k=ans1+ans2+ans3+ans4+ans5;
x
y
formatSpec = '‘The value of y corresponding to x=-2.5 is %f ';
fprintf(formatSpec,k)
-----------------------------------------------------------------------
SAMPLE OUTPUT:
x =
-4 -3 -2 -1 0
y =
5 0 3 2 9
‘The value of y corresponding to x=-2.5 is 1.812500
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.