How do I use single precision numbers in a summation? My result is not coming out as expected.

3 次查看(过去 30 天)
So this is the question I havve. However, when I change all the numeric values to single precision, it does not make a difference in the output. Any idea what I am doing wrong?
any suggestions would be appreciated!

采纳的回答

Walter Roberson
Walter Roberson 2023-9-25
You are not doing repeated addition. Repeated addition is not the same as multiplication.
Also, a and b are scalar, so a*b is a scalar, and there is no point in sum() of a scalar.
Hint: see repelem and repmat
  4 个评论
Elaina
Elaina 2023-9-25
Ok, I had tried creating am array earlier but I obviously did not do it correctly. I used repmat and that fixed it. Thank you!

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

产品


版本

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by