This is not the real function I have problem with. But this one a good example of the problem I have.
function [Y] = testf(a,b,c,X) Y=dot([a b],[c X]); end
a,b,c,d are previously determined scalar variables (real) and X a vector.
E.g.:
a=1; b=2; c=3; X=[-10:1:10];
I want to evaluate function f to each element of X keeping a,b,c constant.
Something like this… But for X more generally.
[testf(a,b,c,-10) testf(a,b,c,-9) testf(a,b,c,-8) ...]
Here is an example:
>> a=1; b=2; c=3; X=[-10:1:10]; >> testf(a,b,c,X) Error using dot (line 33) A and B must be same size. Error in testf (line 2) Y=dot([a b],[c X]);
I know where the error is, but any solution to this?
Best Answer