Element-wise exponentiation returning incorrect answers

I am trying to write a simple program to get acquainted with MATLAB, and I am having an error where I am trying to square a matrix element-wise and it is giving me incorrect numbers. The strange thing is that it does the math correctly if I don't include the step where I multiply my matrix by a scalar. Code and outputs are attached; first output is the initial matrix, second output is the matrix after the scalar is applied, third is after the attempted exponentiation. Thank you in advance for reading what is probably a stupid question.

1 件のコメント

James Tursa
James Tursa 2023 年 9 月 6 日
In the future, always post code as regular text highlighted by the CODE button. We can copy and run text code. We can't copy and run images of code.

サインインしてコメントする。

 採用された回答

Ben
Ben 2023 年 9 月 6 日

0 投票

Just noticed that the results are correct, just scaled down by a factor of 1000. Feel a bit stupid now. NVM

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeCreating and Concatenating Matrices についてさらに検索

製品

リリース

R2023a

タグ

質問済み:

Ben
2023 年 9 月 6 日

コメント済み:

2023 年 9 月 6 日

Community Treasure Hunt

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

Start Hunting!

Translated by