Question

Develop, debug and test a program in Matlab to implement cubic spline interpolation. Calculate f(2.25) utilizing...


Develop, debug and test a program in Matlab to implement cubic spline interpolation. Calculate f(2.25) utilizing the data

x = 1.6, 2, 2.5, 3.2, 4, 4.5

f(x) = 2, 8, 14, 15, 8, 2

USE MATLAB CODE

Homework Answers

Answer #1

Solution:

  • My code uses in-built cubic spline interpolation code to compute output.
  • csapi() takes input parameters x, f(x) and new values to compute, and fetch output for new values entered.

Matlab Code:

x = [1.6 2 2.5 3.2 4 4.5];
y = [2 8 14 15 8 2];
xx = 0:.25:5;
yy = csapi(x,y,xx);
plot(x,y,'o',xx,yy)

Output:

So output for f(2.25) is computed using:

  • ans = csapi(x,y,2.25)
  • This will give output: ans = 11.4167

PS: Let me know if you have any doubt.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Please use MATLAB to solve it. Develop, debug, and test your own M-file to multiply two...
Please use MATLAB to solve it. Develop, debug, and test your own M-file to multiply two matrices—that is, [X ] = [Y ][Z], where [Y] is m by n and [Z] is n by p. Employ for...end loops to implement the multiplication and include error traps to flag bad cases.
Curve-Fit Function USING MATLAB Using the top-down design approach, develop a MATLAB function A8P2RAlastname.m that reads...
Curve-Fit Function USING MATLAB Using the top-down design approach, develop a MATLAB function A8P2RAlastname.m that reads data from a file and performs regression analysis using polyfit and polyval. The function shall have the following features: The input arguments shall include the file name (string), a vector of integers for the degrees of polynomial fits to be determined, and an optional plot type specifier (‘m’ for multiple plots, ‘s’ for a single plot - default). The data files will be text...
DUE ASAP ! Program Assignment: 1. Implement the following 3 scheduling Algorithms: a. First Come, First...
DUE ASAP ! Program Assignment: 1. Implement the following 3 scheduling Algorithms: a. First Come, First Served (batch, non preemptive) (FCFS) b. Shortest Job First (batch, non preemptive) (SJF) c. Round Robin (preemptive) (RR) 2. Implement Using C or C++ on a Linux machine 3. To run the 3 scheduling algorithms, create a Priority Scheduling Program with menu options that will call the 3 scheduling programs, (fcfs, sjf, and Round Robin). These are simulation algorithms, that will be run from...
Implement the following functions in the given code: def random_suit_number(): def get_card_suit_string_from_number(n): def random_value_number(): def get_card_value_string_from_number(n):...
Implement the following functions in the given code: def random_suit_number(): def get_card_suit_string_from_number(n): def random_value_number(): def get_card_value_string_from_number(n): def is_leap_year(year): def get_letter_grade_version_1(x): def get_letter_grade_version_2(x): def get_letter_grade_version_3(x): Pay careful attention to the three different versions of the number-grade-to-letter-grade functions. Their behaviors are subtly different. Use the function descriptions provided in the code to replace the pass keyword with the necessary code. Remember: Parameters contain values that are passed in by the caller. You will need to make use of the parameters that each...
A toy company buys large quantities of plastic pellets for use in the manufacturing of its...
A toy company buys large quantities of plastic pellets for use in the manufacturing of its products.  The production manager wants to develop a forecasting system for plastic pellet prices and is considering four different approaches and 6 different models.  He plans to use historical data to test the different models for accuracy.  The price per pound of plastic pellets (actual) has varied as shown: Month Price/Pound 1 $0.39 2 0.41 3 0.45 4 0.44 5 0.40 6 0.41 7 0.38 8 0.36...
Programming Exercise 2: implement the member function moveToNth(...) that removes the item marked by the cursor...
Programming Exercise 2: implement the member function moveToNth(...) that removes the item marked by the cursor and inserts it as the nth element of the list; test your implementation by turning the flag LAB3_TEST2 from 0 to 1 in config.h; - Programming Exercise 3: implement the ListArray member function find(...) that searches for the element given as a parameter; the search starts at the cursor and stops when it finds the element or at the end of the list; the...
The table below shows a set of bivariate data: X and Y. Calculate the covariance and...
The table below shows a set of bivariate data: X and Y. Calculate the covariance and correlation coefficients by completing the below table, assuming sample data. Show all workings. (Note: You can calculate the mean and standard deviation of X & Y with Excel or your calculator; no working for their calculation is required.) X Y (X - X bar) (Y - Y bar) (X - X bar)(Y - Y bar) 5 5 -0.2 -0.6 0.12 2 3 -3.2 -2.6...
Write a sequence of two instructions that copies bits 0-5 from AL to bits 0-5 in...
Write a sequence of two instructions that copies bits 0-5 from AL to bits 0-5 in BL. Bits 6-7 in BL should be cleared, and AL should be unchanged             Mov al, bl       And 00111111, bl       Write a sequence of two instructions that copies the integer in bits 4-7 from AL register into bits 0-3 of the BL register. Upper 4 bits of AL and BL will be cleared             Shr al, 4       Mov bl,...
Java question, Please answer everything. Thank you Answer the following questions as briefly (but completely) as...
Java question, Please answer everything. Thank you Answer the following questions as briefly (but completely) as possible: What is a checked exception, and what is an unchecked exception? What is NullPointerException? Which of the following statements (if any) will throw an exception? If no exception is thrown, what is the output? 1: System.out.println( 1 / 0 ); 2: System.out.println( 1.0 / 0 ); Point out the problem in the following code. Does the code throw any exceptions? 1: long value...
Historically, the MBA program at Whatsamattu U. has about 40% of their students choose a Leadership...
Historically, the MBA program at Whatsamattu U. has about 40% of their students choose a Leadership major, 30% choose a Finance major, 20% choose a Marketing major, and 10% choose no major. Does the most recent class of 200 MBA students fit that same pattern or has there been a shift in the choice of majors. Using the sample of 200 students (in the data file), conduct a Chi Square Goodness of Fit test to determine if the current distribution...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT