How do i fix the negative and identical outputs i am getting under the FOR loop?

1 回表示 (過去 30 日間)
i am currently experiencing a challenge under my FOR loop, e.g my W_3 is generating similar and negative outputs while the inputs into the formular are all positive and this is happening throughout the loop.

採用された回答

Shunichi Kusano
Shunichi Kusano 2019 年 2 月 13 日
"c", the speed of light, defined before the loop is overwritten in the loop. This causes the problem.

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2019 年 2 月 13 日
you are reusing the variable name c . looks like the speed of light before the loop but inside it is reassigned one of the matrix coefficients .
By the way do you have a good reason for approximating pi to only 3.142 ? if so you should comment .

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by