MATLAB: Generate anonymous functions from vectors

anonymous functionmatlab functiontransfer function

For example, the vector [a b c ….], I want to generate an anonymous function fun=@(t) -(a*t(1)+b*t(2)+c*t(3)+…..) ,How to do it?

Best Answer

fun=@(t) -( vector(:).' * t(:) )