{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# prob4 - "y38"(d Plot y38 v the x values created...

This preview shows page 1. Sign up to view the full content.

% 8/29/2009 5:55 PM % Script Name: prob4 % Script Variables: % 1. yInterp - Interpolated y-point for x = 6.25 using interp1 % 2. y38 - A vector with 20 y points for x between 3 and 8 % % Problem Statement: % In the given "prob4" script, x = [1 2 4 6 9 10] and y = 3:8. % % (a) Plot y vs. x. Title the plot "y vs. x", and label the axes "x-axis" % and "y-axis". Use a red line. % % (b) Using interp1, calculate the interpolated value for x=6.25. Store % the answer in the variable "yInterp". % % (c) Using interp1 and 20 evenly spaced values of x between 3 and 8, % calculate the corresponding y values, and save them in the variable
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: % "y38". % % (d) Plot y38 v. the x values created for interp1 on the same plot as % the original. Use blue points. See prob4.jpg for an example. x = [1 2 4 6 9 10]; % DO NOT EDIT THIS LINE y = 3:8; % DO NOT EDIT THIS LINE plot(x, y, 'r-'); title('y vs. x'); xlabel('x-axis'); ylabel('y-axis'); yInterp = interp1(x, y, 6.25); x38 = linspace(3, 8, 20); % vector of 20 evenly spaced valuse between 3 and 8 y38 = interp1(x, y, x38); hold on plot(x38, y38, 'b.');...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online