I have an anonymous function like this one:
f = @(t) 5.*cos(t) + 10.*sin(t);
f([1,2])
ans =
11.1162 7.0122
Is it possible to define f using a dot product operation or similar, something along the lines of this?
f = @(t) dot([5,10], [cos(t), sin(t)]);
(which obviously fails when t has more than 1 element)
My actual problem involves much larger vectors, where typing it all out doesn't look too neat.
Consider doing
dotby hand:I assumed t is an n x 1 vector.