Vectorizing code ( calling a function with input as a matrix ) fails
1 view (last 30 days)
I have a function
% function f=eu(c,theta, alpha, beta,P,D )
Then input c is a 1*2 matrix. Now I have C which is a 5051 *2 matrix. I would like to call function eu 5051 times and calculate its value for every row of C. I know I can write a loop for that but it is slow. So I want to do something called Vectorizing code. I tried this way.
u=eu1(C,theta, alpha, beta,P,D )
But the result u is still a scalar but not a 5051*1 vector as I expected it to be. Do you know where I am wrong?