Bird
0
0

You have temperature data temp = [15 18 21 24] measured at times time = [0 3 6 9] hours. How would you find the temperature at 4.5 hours using cubic interpolation in MATLAB?

hard📝 Application Q15 of 15
MATLAB - Numerical Methods
You have temperature data temp = [15 18 21 24] measured at times time = [0 3 6 9] hours. How would you find the temperature at 4.5 hours using cubic interpolation in MATLAB?
Ainterp1(time, temp, 4.5)
Binterp1(time, temp, 4.5, 'cubic')
Cinterp1(time, temp, 4.5, 'linear')
Dinterp1(temp, time, 4.5, 'cubic')
Step-by-Step Solution
Solution:
  1. Step 1: Identify correct argument order and method

    Syntax is interp1(x, y, xi, method). Here x=time, y=temp, xi=4.5, method='cubic'.
  2. Step 2: Choose cubic interpolation

    interp1(time, temp, 4.5, 'cubic') uses 'cubic' method correctly for smooth interpolation.
  3. Final Answer:

    interp1(time, temp, 4.5, 'cubic') -> Option B
  4. Quick Check:

    Use 'cubic' for smooth interp [OK]
Quick Trick: Use 'cubic' as 4th argument for smooth interp [OK]
Common Mistakes:
  • Swapping time and temp vectors
  • Using default linear instead of cubic
  • Omitting interpolation method argument

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More MATLAB Quizzes