Graphs in Fortran: Making tcentre(i) vs. t(i)

In summary, the conversation discusses a program that needs to create a graph of tcentre(i) against t(i) using certain declared variables and constants. A do loop is used to calculate and assign values to the variables, and a Newton method is used to generate roots. Other variables are then calculated to find the temperature at the center for each value of time. The conversation also mentions using graphics packages to create the desired graph.
  • #1
polka129
43
0
hello..here is a program..

and i need to make a graph of tcentre(i) against t(i)..how to do this...

these variables are bold in the below code


Code:
!here are the declaration of variables 

DIMENSION THEETA(10),DF(10),F(10),c(10),b(10),t(10),z(10),sum_1(10),Tcenter(10),r(10),w(10)
REAL K,THEETA,DF,F,c,b,sum_1,x,z,T0,Tcenter,alpha,r,q
integer t,y,p,j,l,m,s

!the assignments of constants 
 			
A = .1
H = 23.
SIGMA = 46.
Alpha=0.000012
K = 1.-(A*H/SIGMA)
EPS = .0001


! initial temperature in KELVIN

T0=250.0+273.0
 

!a do loop which caculates and assigns elements to the declared variables
 
DO N=1,10
!
! First calculating THEETA value
!
RN = N
THEETA(N)=(1.-1./(((RN-0.5)**2)*(3.142**2)*(K**2)))*3.142*(RN-0.5)
!
! Then using that THEETA value we get derivative
! converting degrees to radians
r(n)=theeta(n)*3.142/180

!derivative


DF(N) = 1./COS(r(N)**2)
!
! Then using that same THEETA value we get F
!
F(N) = r(N)*(1./K)

  WRITE(*,*)r(n),df(n),f(n)


 



END DO


! here starts the loop for generation of roots

!Newton method used

  	s=1	

do l=1,10

	

           do 

			  if(s.EQ.L)q=r(s) 
			  



	10       x=q-(q*(1./K)/1./COS(q**2))


	if (abs(x-q).lt.eps)goto 20

	q=x

	goto 10

	end do


	20 	 w(l)=x


   ! thee roots are printed
	 write(*,*)'roots',w(l)

	  
	
	
	   s=s+1

	end do


!-----------------

!-calculation of other variables in the temperature formula





	do p=1,10

 
 C(p)=(4*sin(w(p)))/(2*(w(p))-sin(2*(w(p))))



B(p)=(w(p)*alpha**2)/(a**2)

   write(*,*)c(p),b(p)

  

   end do


	do i=0,9

	t(i)=i*60

	[B]print*,'time',t(i)[/B]

	enddo

!- this loop calculates the temperature at the centre for each value of time  
do j=1,10

 y=j-1
z(j)=-(b(j)*t(y))
sum_1(j)=(C(j)*z(j))



  Tcenter(j)=T0*((a*h)/(sigma))*sum_1(j)

  write(*,*)'temperature at centre',[B]Tcenter(j)[/B]


 

 


  end do






end
 
Physics news on Phys.org
  • #2
Fortran itself doesn't have any graphing capabilities that are part of the language, to the best of my knowledge, but perhaps there are some graphics packages that you can import to do this.

Are you doing this on your own or is it a part of a class. If it's for a class, your instructor should provide some means for your to be able to graph a set of data.

If you're doing it on your own or as a work project, either ask someone about graphics packages or do a Web search for something like "Fortran graphics package". That's what I would do.
 

Related to Graphs in Fortran: Making tcentre(i) vs. t(i)

What is the purpose of creating a graph in Fortran?

The purpose of creating a graph in Fortran is to visually represent data and analyze trends or patterns in the data. This can help in making informed decisions and understanding complex data sets.

How do I make a graph in Fortran?

To make a graph in Fortran, you need to use a plotting library such as the GNU Plot library or the PLplot library. These libraries provide functions that allow you to create different types of graphs, such as line graphs, scatter plots, and bar graphs.

What is tcentre(i) vs. t(i) in Fortran?

tcentre(i) vs. t(i) in Fortran refers to the values on the x-axis and y-axis, respectively, in a graph. The t(i) values represent the data points, while the tcentre(i) values represent the center points of each data point. This can be useful when creating certain types of graphs, such as histograms.

Can I customize the appearance of my graph in Fortran?

Yes, you can customize the appearance of your graph in Fortran by using various functions provided by the plotting library. These functions allow you to change the color, style, and labels of the axes, as well as add a title and legend to your graph.

Are there any other options for creating graphs in Fortran?

Yes, there are other options for creating graphs in Fortran, such as using external programs like Gnuplot or Matplotlib. These programs offer more advanced features and customization options compared to the built-in plotting libraries in Fortran.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
7
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
10
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
1K
Back
Top