Error when using distributive property
显示 更早的评论
Hello!
The function below compares the output of two functions which run the same calculation. However, in one function the calculation's multiplications are distributed. It should output a matrix of 1s. However, it doesn't!
What's up with that?
function errorTest()
compute(1:100) == distributed(1:100)
function out = compute(a)
out = 10.1 * (a - 1);
end
function out = distributed(a)
out = 10.1 * a - 10.1;
end
end
Thanks!
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Multivariate Distributions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!