11.9. Homework 9 - Function to Calculate 2-Dimensional Array DataΒΆ

Write a C program that uses a function to calculate f(x, y) for the equation below over the range of values: -1 \leq x \leq 5 with a step size of $1$ and 2 \leq y \leq 4 with a step size of 0.5.

f(x, y) = \frac{3x^{2} + 4y + 3}{5 \, sin(y^{2}) + 4x^{2} + 3}

Use the following function prototype for the function f(x, y):

double f(double, double);

Print the calculated values as a matrix of values where the columns represent x values and the rows (lines) represent the y values. Print the numbers with 3 digit precision.

In case you are wondering what the data should look like, below is a plot of the data (made using MATLAB).

../_images/2dArrayplot.png