Azzera filtri
Azzera filtri

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

3 visualizzazioni (ultimi 30 giorni)
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!

Risposta accettata

Walter Roberson
Walter Roberson il 25 Set 2023
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 Commenti
Elaina
Elaina il 25 Set 2023
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!

Accedi per commentare.

Più risposte (0)

Prodotti


Release

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by