Plotting 3D graphs for a script involving big loop

In summary, The conversation discusses plotting a 3D graph in a script. The main variables to be plotted are 'pic', 'TSFC', and 'NonFs'. The script includes calculations for these variables and the graph can be created using contour, wireframe mesh, or solid plots.
  • #1
sgvaibhav
68
0
I want to plot a 3D graph.
A solid graph and a wireframe mesh graph.

What are the different ways to do it in this script.
The variables i want to be plotted in this script are 'pic' 'TSFC' 'NonFs'.
Dont mind the working, everything is correct. The only matter of concern is the 3d graph and the variables to plot.

What are the different ways that i can do it?

Script attached and pasted below as well.

Code:
clear
gamma=1.4;
gammat=1.33;
cpt=1156.697;
cpc=1004.5;
Qr=42800*10^3;

P0=21.73*10^3;
Pt0=170.025*10^3;

T0=216.67;
Tt0=390;

V0=590.1119;
a0=(gamma*287*T0).^0.5;

Pt2=Pt0;
Tt2=Tt0;
Tt4=(7*cpc*T0)/cpt;
P9=P0;

for i=1:40
    
    pic(i)=i;
    
    %Compressor
    Pt3(i)=pic(i)*Pt2;
    
    Towc(i)=pic(i).^(2/7);
    Tt3(i)=Towc(i)*Tt2;
    
    %Burner
    Pt4(i)=Pt3(i);
        
    f(i)=(cpt*Tt4 - cpc*Tt3(i))/(Qr - cpt*Tt4);
    
    %Turbine
    Tt5(i)=Tt4 - ((cpc*(Tt3(i)-Tt2))/(cpt*(1+f(i))));
    Towt(i)=Tt5(i)/Tt4;
    
    pit(i)=Towt(i).^(gammat/(gammat-1));
    Pt5(i)=Pt4(i)*pit(i);
    
    %Nozzle
    Pt9(i)=Pt5(i);
    Tt9(i)=Tt5(i);
    
    M9(i)= (5 * ( (Pt9(i)/P9).^((gammat-1)/gammat) -1 ) ).^0.5;
    
    T9(i)=Tt9(i)./(1+0.5*(gammat-1)*(M9(i).^2));
    
    V9(i)=M9(i).*(gammat*287*T9(i)).^0.5;
    
    Fs(i)=(1+f(i)).*V9(i)-V0;
    TSFC(i)=(1000000.*f(i))./Fs(i);
    NonFs(i)=Fs(i)./a0;
    
end
clear i

%dont mind the working, everything is correct, the main matter of concern
%is the graph, and the variables to plot which are 'pic' 'TSFC' And 'NonFs'

%i want to draw  a 3D graph of these variables, either contour, or a
%wireframe or solid...what are the different ways to do it?
 

Attachments

  • Question_4_19_c_test2.m
    1.3 KB · Views: 359
Physics news on Phys.org
  • #2
%3D Graphs%Contour Plotfigurecontour3(pic, TSFC, NonFs);xlabel('pic'); ylabel('TSFC'); zlabel('NonFs');title('Contour Plot');%Wireframe Mesh Plotfiguremesh(pic, TSFC, NonFs);xlabel('pic'); ylabel('TSFC'); zlabel('NonFs');title('Wireframe Mesh Plot');%Solid Plotfiguresurf(pic, TSFC, NonFs);xlabel('pic'); ylabel('TSFC'); zlabel('NonFs');title('Solid Plot');
 

1. How do I plot a 3D graph for a script involving a big loop?

To plot a 3D graph for a script involving a big loop, you will need to use a programming language that has built-in functions for creating 3D graphs such as Python or Matlab. You will also need to have a dataset or function that you want to visualize in a 3D format.

2. What is the purpose of plotting 3D graphs for a script involving a big loop?

The purpose of plotting 3D graphs for a script involving a big loop is to visually represent data or functions in a three-dimensional space. This can help with understanding complex relationships and patterns that may not be easily visible in a 2D graph.

3. What are the steps for plotting a 3D graph for a script involving a big loop?

The steps for plotting a 3D graph for a script involving a big loop may vary depending on the programming language you are using, but generally they include: importing necessary libraries, creating a loop to generate data points, selecting and configuring the appropriate 3D graph type, and labeling and styling the graph.

4. Are there any limitations to plotting 3D graphs for a script involving a big loop?

Yes, there are some limitations to plotting 3D graphs for a script involving a big loop. Some programming languages may have limitations on the size or complexity of the data that can be plotted in a 3D graph. Additionally, 3D graphs can become difficult to interpret if there are too many data points or if the data is too closely clustered together.

5. Can I customize the appearance of my 3D graph for a script involving a big loop?

Yes, you can customize the appearance of your 3D graph for a script involving a big loop. Most programming languages have options for changing the color, size, and style of the graph, as well as adding labels and annotations. You can also adjust the viewing angle and perspective of the graph to better visualize your data.

Back
Top