To calculate the inner product of two vectors x and y in Rn, we need to take the transpose of x and multiply it with y.
In MATLAB, this can be simply done using the built-in function dot().
main.m90 chars10 lines
The output will be 32, which is the inner product of x and y.
Alternatively, we can use matrix multiplication to get the same result.
main.m87 chars10 lines
Here, we have taken the transpose of y to make it a column vector, and then used matrix multiplication to get the inner product.
Again, the output will be 32.
gistlibby LogSnag