Matrix Operations for Inputs as Function Handles
Show older comments
Hi!
I want to minimize this function with respect to h.
f1 = @(h) integral((psitildasq.*((1 - psibar).^2)),(-40),40,'ArrayValued',true);
where,
psitildasq = @(t) (1/n^2)*sum((cos(x.*t))).^2 + (1/n^2)*sum((sin(x.*t))).^2;
psibar = @(t,h) sum(exp((b.*t.*h).^2))./n;
I consider h and t as scalars. x is my (1,n) vector of input variables and b is another (1,n) vector of inputs.
But when I give the command
[h,hval] = fminbnd(f1,0,3);
Matlab gives me the error
"Undefined function 'minus' for input arguments of type 'function_handle'"
I don't quite understand where I am doing the mistake.
I would be grateful to learn about a way to write the function in the correct way.
Accepted Answer
More Answers (0)
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!