Filter löschen
Filter löschen

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

1 Ansicht (letzte 30 Tage)
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);

Akzeptierte Antwort

N/A
N/A am 2 Dez. 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.

Weitere Antworten (0)

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by