Explore BrainMass

Metlab Functions: Two Row Vectors as Inputs

Write a Matlab function that will accept two row vectors (A and B) as inputs. The function computes the row vector C that is the term-by- term product of A and B (that is, C1= A1*B1, C2=A2*B2, and so on), and that then computes the values of the function sin(x) for each value of C and stores these values in the row vector D. The outputs of the program are the arrays C and D.

For demonstration of the function, the array A and B are:
A = 1.2, 3.5, 6.7, 8.3, 0.9, 4.2
B = 0.5, 1.0, 0.08, 0.2, 1.3, 0.85

Solution Preview

I attached two files.

"Term_by_term.m" contains the requested function. It checks that the ...

Solution Summary

This solution provides guidelines on how to write a Metlab function that will accept two row vectors as inputs.