Question: You will write a program in C that multiplies a matrix by a vector, using Matlab to check the results. Create a program in C

You will write a program in C that multiplies a matrix by a vector, using Matlab to check the results.

Create a program in C that prompts the user to enter two file names, opens the files, and reads the data into dynamically allocated arrays based on the size of the data.

The first file will contain a matrix of arbitrary size. The format of the file will consist of two lines with a single integer on each line. These two values will represent the number of rows and columns respectively. The remainder of the file will consist of a comma separated array of floating point values. This will store the matrix.

The second file will be similar to the first, but will contain a single integer on the first line representing the number of rows in the file. Each subsequent line will contain a single floating point number. This file will store the vector.

The files can be generated in Excel and saved as CSV (comma separated value) files. If using a non-Windows based computer, save in "Windows CSV" format.

Once the data has been successfully read into the dynamic arrays, perform the matrix-vector multiply using equations and a description provided. Write the result out to a file called "output.csv."

Use MATLAB to verify that the matrix vector product is correct.

If completed correctly, the program will successfully read and parse the input as well as produce the matrix-vector product.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!