How to find the scalar multiple of two vectors?
2 次查看(过去 30 天)
显示 更早的评论
Example; a=[1;2;3] and b=[2;4;6], hence the lambda is 2.
0 个评论
回答(1 个)
James Tursa
2018-5-18
编辑:James Tursa
2018-5-18
E.g., (with some accounting for potential 0 values)
d = b ./ a;
result = mean(d(~isnan(d)));
This is naive code that assumes the same scalar applies to all elements. If it is possible that is not the case, you would need to tell us how to handle the situation.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Graphics Object Programming 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!