Error with using the multiplication sign

I have this code:
final_ans = (1/(4*pi*(8.85*(.0000000000001))))*(y/(t*t));
but matlab will not compute it because it says "Incorrect dimensions for matrix multiplication", even though I am not multiplying a matrix. How do I fix it?

回答 (1 件)

Walter Roberson
Walter Roberson 2022 年 9 月 14 日

1 投票

Your t is a vector so t*t is matrix multiplication between t and itself. You need t.*t or t.^2
However you will need another change as well. (y/(t*t)) will not (y./(t.*t)) or (y./t.^2)

カテゴリ

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

質問済み:

2022 年 9 月 14 日

回答済み:

2022 年 9 月 14 日

Community Treasure Hunt

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

Start Hunting!

Translated by