I have the following m file andI am getting an "Index exceeds array bounds". I am trying to figure out why.

1 view (last 30 days)
The objective of this is todetermine the rate of change of temperature for 2881 timesteps. I am trying to run a for loop for each time step but I am getting an error saying that the index exceeds the array bounds.
Error in Shivam723 (line 164)
Tempchange1(i) = (a1*J_sun*Asun + e1*J_ear*Aearth -
e1*sigma*TPanel1(i-1)*Asat)/(satmass*sp_heat);

Accepted Answer

N/A
N/A on 2 Dec 2018
I found the solution.
TPanel(1:6) was defined early on.
The issue was that while the initial TPanel(i-1) value was being assesed, the TPanel (i-1) wasn't being saved for the next iteration. Hence why it stopped after the first loop. Correcting this error, and a few other small ones made the code work as intended.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!