MATLAB quad and difficulty with vector input

1 reply · 5K views · last reply
PlasticOh-No
Messages
18
Reaction score
0
MATLAB "quad" and difficulty with vector input

Hello all.

Consider the following:

function y = testf(x,a)
y = sin(pi.*a.*x);

...and then we have

a = 0.05:0.05:1;
result1 = quad(@(x)testf(x, a),0,1)

which crashes with

? Error using ==> times
Matrix dimensions must agree.

Can you help?
Thank you.
 


Oops. Is this just a matter of using quadv instead of quad?