Matrix Operations for Inputs as Function Handles
显示 更早的评论
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.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!