Connecting plot points from nested loops

In summary, the conversation discusses a project involving calculating the Mach number at different altitudes for various mdotf values. The code for the project is being shared, along with an Excel sheet containing data used in the calculations. The poster is having trouble with plotting the results and asks for assistance. They later provide an update, stating that they have solved the issue.
  • #1
roldy
237
2
Here's small part of a project I'm working on. The code is not part of the grade. I'm just doing this for my own benefit and I figured that MATLAB can do the plotting automatically for me.

Calculate the Mach number at each of the three altitudes for mdotf=.1, .2, .3, .4, .5, .6, .7 The flight Mach number is M_0.

I'm plotting Thrust vs. M_0 for 7 different mdotf values. I need to do this at 3 different altitudes.

I wrote the code to do just this. But I'm stuck at plotting out the three plots.

The code grabs data from an excel sheet to use in calculating M_0. I wanted to have flexibility with the data; in case I needed make a change in the excel sheet, I won't have to change all the values that I'm using in MATLAB. You won't have to do anything with the Excel file. Attached is the .m file and the Excel sheet in a zip file. They have to be in the same folder of course in order to work.
 

Attachments

  • Performance Envelope.zip
    83.1 KB · Views: 295
Physics news on Phys.org
  • #2
Rather than posting the .zip file, why not just post the MATLAB code in between the [CODE ][/CODE ] tags? A little more description of the data file (format / structure) would also assist us in helping you debug this.
 
  • #3
I figured out my problem. Thanks for the reply.
 

1. How do nested loops help in connecting plot points?

Nested loops are a programming concept that allows for the repetition of a set of instructions within another set of instructions. This can be useful in connecting plot points by allowing for the execution of specific actions or events that are dependent on each other.

2. What is the structure of nested loops?

Nested loops typically consist of an outer loop and an inner loop. The outer loop controls the number of times the inner loop is executed, while the inner loop controls the specific actions or events that occur within each iteration of the outer loop.

3. Can nested loops be used in any type of plot?

Yes, nested loops can be used in any type of plot, as long as there is a need for connecting plot points. This could be in a linear narrative, a non-linear storyline, or even a branching storyline.

4. How do you decide when to use nested loops in a plot?

The decision to use nested loops in a plot depends on the complexity of the plot and the specific needs of the story. If there are multiple plot points that are interconnected and affect each other, using nested loops can help to create a more cohesive and logical storyline.

5. Are there any potential drawbacks to using nested loops in a plot?

One potential drawback of using nested loops in a plot is that it can make the code more complex and difficult to follow. This can make it challenging to debug and make changes to the plot if needed. It is important to carefully plan and organize the nested loops to avoid confusion and potential errors.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
135
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
4K
Back
Top