How to let 2 vector row to multiply by itself
이전 댓글 표시
hi I want vector m to multiply with n but for some reason I got this
input(4,7)
i =
4 5 6 7
output =
16 25 36 49
this is my code
function output=input(m,n)
i=m:n
output=i.*i
end
댓글 수: 6
James Tursa
2020년 9월 17일
What exactly is the numeric output you desire? Your current code squares each element, which apparently is not what you wanted. Maybe you wanted output = i * n?
Dai Nguyen
2020년 9월 17일
Dai Nguyen
2020년 9월 17일
Dai Nguyen
2020년 9월 17일
madhan ravi
2020년 9월 17일
? Doesn’t prod() do what you want? Or your ”homework” requires a loop?
Dai Nguyen
2020년 9월 17일
답변 (1개)
카테고리
도움말 센터 및 File Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!