How do I perform this integration?
显示 更早的评论
H=[11 22 33 44 55 66];
R=[1 2 3 4 5];
f_low=[1000 3000 5000 7000 9000];
f_high=[2000 4000 6000 8000 10000];
Const=5;
RESULTS=[];
for i=1:length(H)
val=quadgk(@(f)MyFunction(f,H,R,Const),f_low(i),f_high(i));
RESULTS=[RESULTS val];
end
+++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++
function int_out=MyFunction(f,H,R,Const)
AAA=Const+2.*sum(H.*cos(2*pi*f*R));
int_out=AAA.^2;
+++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++
I get the following Error:
Error using * Inner matrix dimensions must agree.
Error in MyFunction (line 3) AAA=Const+2.*sum(H.*cos(2*pi*f*R));
Error in @(f)MyFunction(f,H,R,Const)
Error in quadgk/evalFun (line 330) fx = FUN(x);
Error in quadgk/f1 (line 348) [y,too_close] = evalFun(tt);
Error in quadgk/vadapt (line 249) [fx,too_close] = f(x);
Error in quadgk (line 188) [q,errbnd] = vadapt(@f1,interval);
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 MATLAB Coder 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!