- #1
roldy
- 237
- 2
I'm working on a piece of code to help me generate plots. Right now I'm focusing on the calculation stuff.
Here's what I need to do.
For each RPMline, calculate the Mach number (M0) for mdotf=.1,.2,.3,.4,.5,.6,.7
I read values of Tt4_Tt2_ratio, pi_c, eff_c, mdotcorr2 from the Excel sheet. As you can see in the code, the value of M0 not only depends on mdotf but also Tt4_Tt2_ratio, pi_c, eff_c, mdotcorr2.
So I have an array called mdotf of all the values of mdotf I need to use. This returns an array called M0, which contains all the Mach numbers based on the mdotf used. After doing this for the first RPMline, it should repeat for the second RPMline and keeps doing this until I've done this for all 8 RPMlines. What I tried to do was set up a loop for the RPMline that would increment Tt4_Tt2_ratio, pi_c, eff_c, mdotcorr2.
I'm always getting this message:
Attempted to access Tt4_Tt2_ratio(2); index out of bounds because numel(Tt4_Tt2_ratio)=1.
If, instead of using the loop, I put in values 1-8 in place of the variable RPMline I get a result. There's some kind of indexing problem between MATLAB and Excel but I can't figure out what it is.
Here's what I need to do.
For each RPMline, calculate the Mach number (M0) for mdotf=.1,.2,.3,.4,.5,.6,.7
I read values of Tt4_Tt2_ratio, pi_c, eff_c, mdotcorr2 from the Excel sheet. As you can see in the code, the value of M0 not only depends on mdotf but also Tt4_Tt2_ratio, pi_c, eff_c, mdotcorr2.
So I have an array called mdotf of all the values of mdotf I need to use. This returns an array called M0, which contains all the Mach numbers based on the mdotf used. After doing this for the first RPMline, it should repeat for the second RPMline and keeps doing this until I've done this for all 8 RPMlines. What I tried to do was set up a loop for the RPMline that would increment Tt4_Tt2_ratio, pi_c, eff_c, mdotcorr2.
I'm always getting this message:
Attempted to access Tt4_Tt2_ratio(2); index out of bounds because numel(Tt4_Tt2_ratio)=1.
If, instead of using the loop, I put in values 1-8 in place of the variable RPMline I get a result. There's some kind of indexing problem between MATLAB and Excel but I can't figure out what it is.