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

1 view (last 30 days)
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.

Accepted Answer

Shunichi Kusano
Shunichi Kusano on 13 Feb 2019
"c", the speed of light, defined before the loop is overwritten in the loop. This causes the problem.

More Answers (1)

Walter Roberson
Walter Roberson on 13 Feb 2019
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 .

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

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

Start Hunting!