Easy question from a newbie
显示 更早的评论
I want to store the function outputs into a vector or matrix using the for loop Here is my code
for n = [10, 100, 1000]
m(i) = abs(compMidpoint(f,a, b,n)-val)
z(i) = abs(compTrapez(f,a, b,n)-val);
s(i) = abs(compSimpsons(f,a, b,n)-val);
i = i+1
end
the matlab reported me an error:
Subscript indices must either be real positive integers or logicals.
m(i) = abs(compMidpoint(f,a, b,n)-val);
Anyone knows what's going on here
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!