Question

In: Electrical Engineering

Q1. Interpolationv (MATLAB PROGRAM ) : Suppose that x = 0:10;? y = [1.5, 1.0, 0.9,...

Q1. Interpolationv (MATLAB PROGRAM ) :

Suppose that x = 0:10;?

y = [1.5, 1.0, 0.9, 2.6, 2.2, 0.03];?

a)Use both linear interpolation and cubic spline interpolation function to determine the value of y when x= 3.5

b) Plot both functions y and the interpolated version of y.

PLEASE SOLVE THE QUESTION USING MATLAB PROGRAM .

Solutions

Expert Solution

x=0:2:10;
y=[1.5, 1.0, 0.9, 2.6,2.2,0.03];
% a). calculating the values of y(3.5) for linear and cubic spline
% interpolations
xq=3.5;
y1=interp1(x,y,xq,'linear') % y(3.5) for linear interpolation method
y2=interp1(x,y,xq,'spline') % y(3.5) for cubic spline interpolation

% b). calculating the values of y for linear and cubic spline
% interpolations and plotting the same along with y
xf=0:0.5:10;
y3=interp1(x,y,xf,'linear'); % y values for linear interpolation method
y4=interp1(x,y,xf,'spline'); % y values for cubic spline interpolation

figure;
plot(x,y,'-bo','linewidth',4);hold on;
plot(xf,y3,':*r','linewidth',2);hold on;
plot(xf,y4,':sr','linewidth',2);grid on; grid minor;
legend('y','y_{linear}','y_{cubic spline}');
xlabel('x');ylabel('y');
title('linear and cubic spline interpolation of y(x)');


Related Solutions

2016 1.4 1.0 0.9 1.1 1.0 1.0 0.8 1.1 1.5 1.6 1.7 2.1 1.3 2017 2.5...
2016 1.4 1.0 0.9 1.1 1.0 1.0 0.8 1.1 1.5 1.6 1.7 2.1 1.3 2017 2.5 2.7 2.4 2.2 1.9 1.6 1.7 1.9 2.2 2.0 2.2 2.1 2.1 2018 2.1 2.2 2.4 2.5 2.8 2.9 2.9 2.7 2.3 2.5 2.2 1.9 2.4 2019 1.6 1.5 1.9 2.0 1.8 find the inflation data for the last 3 years: 1. What are your thoughts about the current state of the economy in terms of the historical inflation data for the last 3...
Q1, what is negations of(∃x ∈ Z)x ≤ 0 ⇒ (∀y ∈ Z). xy > 0...
Q1, what is negations of(∃x ∈ Z)x ≤ 0 ⇒ (∀y ∈ Z). xy > 0 Q2, Prove by induction that 14n + 12n − 5 n is divisible by 7 for all n > 0
Please show all steps!!!! 1. Let Q1=y(1.1),Q2=y(1.2),Q3=y(1.3), where y=y(x) solves y′′+ (−3.75)y′+(3.125)y= 0, y(0) = 1.5,...
Please show all steps!!!! 1. Let Q1=y(1.1),Q2=y(1.2),Q3=y(1.3), where y=y(x) solves y′′+ (−3.75)y′+(3.125)y= 0, y(0) = 1.5, y′(0) =−0.625 2. Let Q1=y(1.1),Q2=y(1.2),Q3=y(1.3), where y=y(x) solves y′′+ (−3.75)y′+(3.125)y= 114e−3.5x, y(0) = 5.5, y′(0) =−14.625. 3. Let Q1=y(1.1),Q2=y(1.2),Q3=y(1.3), where y=y(x) solves y′′+ (−3.75)y′+(3.125)y=−5e1.25x, y(0) = 1.5, y′(0) = 3.375 For all of the above Let Q= ln(3 +|Q1|+ 2|Q2|+ 3|Q3|). Then T= 5 sin2(100Q)
Solve this differential equation using Matlab yy' + xy2 =x , with y(0)=5 for x=0 to...
Solve this differential equation using Matlab yy' + xy2 =x , with y(0)=5 for x=0 to 2.5 with a step size 0.25 (a) Analytical (b) Euler (c) Heun d) 4th order R-K method Display all results on the same graph
Evaluate the Riemann sum for f ( x ) = 0.9 x − 1.5 sin (...
Evaluate the Riemann sum for f ( x ) = 0.9 x − 1.5 sin ( 2 x ) over the interval [ 0 , 2.5 ] using five subintervals, taking the sample points to be right endpoints. step by step and answer please. can u also show me how to enter in ti 83.
Let X and Y be random variables. Suppose P(X = 0, Y = 0) = .1,...
Let X and Y be random variables. Suppose P(X = 0, Y = 0) = .1, P(X = 1, Y = 0) = .3, P(X = 2, Y = 0) = .2 P(X = 0, Y = 1) = .2, P(X = 1, Y = 1) = .2, P(X = 2, Y = 1) = 0. a. Determine E(X) and E(Y ). b. Find Cov(X, Y ) c. Find Cov(2X + 3Y, Y ).
Consider the finite duration signal x(n) = (0.9)ncos(0.1πn) for 0 ≤ n ≤ 31. Using MATLAB:...
Consider the finite duration signal x(n) = (0.9)ncos(0.1πn) for 0 ≤ n ≤ 31. Using MATLAB: a.) Plot the signal b.) Plot the real part of the DFT of x(n), the imaginary part of the DFT of x(n) and the DCT of x(n). All transforms are length N = 32.
Find y as a function of x if y(4)−12y‴+36y″=−512e-2x y(0)=−1,  y′(0)=10,  y″(0)=28,  y‴(0)=16 y(x)=
Find y as a function of x if y(4)−12y‴+36y″=−512e-2x y(0)=−1,  y′(0)=10,  y″(0)=28,  y‴(0)=16 y(x)=
y'=y-x^2 ; y(1)= -4 Write a MATLAB program that makes two plots of the solution to...
y'=y-x^2 ; y(1)= -4 Write a MATLAB program that makes two plots of the solution to the equation using the following values. Suggest you use nested loops instead of two different loops. Be sure to label your plots. a. x0 = 1.0, step size h = .2, number of steps n = 20. b. x0 = 1.0, step size h = .05, number of steps n = 80.
1. Let Q1=y(1.1), Q2=y(1.2), Q3=y(1.3) where y=y(x) solves y′′−2y′+ 5y= 0, y(0) = 1, y′(0) =...
1. Let Q1=y(1.1), Q2=y(1.2), Q3=y(1.3) where y=y(x) solves y′′−2y′+ 5y= 0, y(0) = 1, y′(0) = 2. 2. Let Q1=y(1.1), Q2=y(1.2) , Q3=y(1.3) where y=y(x) solves y′′−2y′+ 5y=e^x cos(2x) , y(0) = 1, y′(0) = 2 Let Q= ln(3 +|Q1|+ 2|Q2|+ 3|Q3|). Then T= 5 sin2(100Q) Please show all steps and thank you!!!!!
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT