# Graphs in fortran

• Comp Sci
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
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

Related Engineering and Comp Sci Homework Help News on Phys.org
Mark44
Mentor
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.