Started learning octave recently. How do I generate a matrix from another matrix by applying a function to each element?
eg:
- Apply 2x+1 or 2x/(x^2+1) or 1/x+3 to a 3×5 matrix A.
- The result should be a 3×5 matrix with the values now 2x+1
- if A(1,1)=1 then after the operation with output matrix B then
- B(1,1) = 2.1+1 = 3
My main concern is a function that uses the value of x like that of finding the inverse or something as indicated above.
regards.
You can try
The operator
.means application of the following operation*to each element of the matrix.You will find a lot of documentation for Octave in the distribution package and on the Web. Even better, you can usually also use the extensive documentation on Matlab.
ADDED. For more complex operations you can use
arrayfun(), e.g.