How to find the scalar multiple of two vectors?

조회 수: 6 (최근 30일)
Mohammad Ezzad Hamdan
Mohammad Ezzad Hamdan 2018년 5월 18일
편집: James Tursa 2018년 5월 18일
Example; a=[1;2;3] and b=[2;4;6], hence the lambda is 2.

답변 (1개)

James Tursa
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.

카테고리

Help CenterFile Exchange에서 NaNs에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by