Help to Fortran translation
Afficher commentaires plus anciens
Hi!
I have a fortran file I have to use in Matlab. Can the MEX function handle that, if so, how? Or can someone help with a translation of the following:
I need to calculate u1 and u2 from some old wind velocity measurements. I can see that the parameters are defined in the beginning, but it is not all of the steps I fully understand.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
subroutine read(ave1,ave2,rms1,rms2,ren)
implicit real*8 (a-h,o-z)
parameter(ntotal=20480000)
parameter (nrd=ntotal*2)
character fn1*50
integer*2 ju(nrd)
dimension u1(ntotal),u2(ntotal)
real*8 usq,dudnsq,dudxsq,epsilon,lambda,Relambda
common /bl1/ u1,u2
common /bl2/ ju
nbytes = 2*nrd
n=ntotal
fn1='/data1/dhruva/two_point/dugway_8_4_98/dug2_4.bin'
open(unit=4,file=fn1,form='unformatted',status='old',
+ access='direct',recl=nbytes)
read(4,rec=1,err=55) (ju(i),i=1,nrd)
goto 60
55 print *,'error ',i,ierr
goto 60
56 print *,'end of file reached'
60 close(4)
print *,'Finish reading raw data file'
open(unit=9,file='datapts.nonconv')
do 65 i=1,15000
write(9,*)ju(i)
65 continue
close(9)
c-----------CONVERT FROM SAMPLING UNITS TO VELOCITY UNITS---------
count=0.0
gain=10.0
offset1=3.16
offset2=2.75
usq=0.0
do 12 i=2,nrd,2
c if (abs(ju(i)) .ge. 2048) then
c count=count+1
c print *,i,ju(i)
c endif
usq = (ju(i)/(gain*409.5)+offset1)**2.0
u1(i/2) = ((usq-5.3885)/1.9786)**2
1 commentaire
Rena Berman
le 12 Oct 2020
(Answers Dev) Restored edit
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Audio and Video Data dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!