Recherche
Posez votre question Signaler

Besoin d'aide:programmer en Matlab ou en C++

giser 1Messages postés vendredi 31 mars 2006Date d'inscription 31 mars 2006Dernière intervention - Dernière réponse le 10 oct. 2007 à 10:49
Voici un programme en fortran dont on peut m'aider à faire en Matlab ou en C++:
Program 2:

1 REM THIS PROGRAM CALCULATES HEAT LOSS FROM A DOUBLE WALL CYLINDRICAL COMBUSTION CHAMBER
5 CLS
7 CLEAR
50 OPEN "LPT1:" FOR OUTPUT AS #1
55 PRINT "ALL UNITS ARE IN KILOGRAMS, METERS, AND SECONDS"
89 PRINT "ENTER NUMBER OF NODES FOR TEMPERATURE TO BE CALCULATED AT IN WALLS"
90 INPUT "ENTER NUMBER OF NODES, >=2, IN WALL 1, S, WALL 2, ZS"; S, ZS
91 PRINT #1, "THE NUMBER OF TEMPERATURE NODES IN THE WALLS ARE "; S, ZS
92 REM FOR A MASSIVE STOVE, S IS TYPICALLY 1 PER CM; FOR A METAL STOVE 1 PER MM.
99 REM THE MATRICES TT(I), TN(I), ZTT(ZI), AND ZTN(ZI) ARE THE VALUES OF THE TEMPERATURE AT THE
CURRENT TIME, TT& ZTT, AND THE NEXT TIME, TN & ZTN
100 DIM TT(S), TN(S), ZTT(ZS), ZTN(ZS)
150 PRINT "ENTER INNER AND OUTER RADIUS OF INNER WALL"
151 INPUT "ENTER RA, RZ"; RA, RZ
152 PRINT #1, "INNER WALL RADII ARE ";
153 PRINT #1, "R4="; RA, "RZ="; RZ
155 PRINT "ENTER INNER AND OUTER RADIUS OF OUTER WALL"
156 INPUT "ENTER ZRA, ZRZ"; ZRA, ZRZ
157 PRINT #1, "OUTER WALL RADII ARE ";
158 PRINT #1, "ZRA="; ZRA, "ZRZ="; ZRZ
160 PRINT "ENTER COMBUSTION CHAMBER HEIGHT"
161 INPUT "ENTER CH"; CH
162 PRINT #1, "COMBUSTION CHAMBER HEIGHT IS ; CH
170 PRINT "ENTER INNER CONVECTIVE HEAT TRANSFER COEFFICIENT"
171 INPUT "ENTER HA"; HA
172 PRINT #1, "THE INNER CONVECTIVE HEAT TRANSFER COEFFICIENT IS "; HA
175 PRINT "ENTER EFFECTIVE EMISSIVITY BETWEEN THE WALLS AND THE OUTER WALL EXTERNAL EMISSIVITY"
176 INPUT "ENTER EE, ZEE"; EE, ZEE
177 PRINT #1, "RADIATIVE COUPLING BETWEEN WALLS, AND EXTERIOR EMISSIVITY ARE"
178 PRINT #1, "EE="; EE, "ZEE="; ZEE
179 REM THE EMISSIVITIES OF INTERIOR SURFACE, FIRE AND AMBIENT ARE ASSUMED TO BE 1.0
180 PRINT "ENTER HEAT CAPACITY, DENSITY, AND THERMAL CONDUCTIVITY OF INNER WALL"
181 INPUT "ENTER HC, HD, HK"; HC, HD, HK
182 PRINT #1, "THE HEAT CAPACITY, DENSITY AND THERMAL CONDUCTIVITY OF THE INNER WALL ARE"
183 PRINT #1, "HC="; HC, "HD="; HD, "HK="; HK
190 PRINT "ENTER HEAT CAPACITY, DENSITY, AND THERMAL CONDUCTIVITY OF OUTER WALL"
191 INPUT "ENTER ZHC, ZHD, ZHK"; ZHC, ZHD, ZHK
192 PRINT #1, "THE HEAT CAPACITY, DENSITY AND THERMAL CONDUCTIVITY OF THE OUTER WALL ARE"
193 PRINT #1, "ZHC="; ZHC, "ZHD="; ZHD, "ZHK="; ZHK
200 PRINT "ENTER THE AMBIENT, GAS, AND FIRE TEMPERATURES"
201 INPUT "ENTER TA, TG, TF"; TA, TS, TF
202 PRINT #1, "THE AMBIENT, GAS, AND FIRE TEMPERATURES ARE"
203 PRINT #1, "TA="; TA, "TG="; TG, "TF="; TF
210 PRINT "ENTER TIME INCREMENT, TOTAL NUMBER OF TIME INCREMENTS TO BE CALCULATED THROUGH, AND
THE P'th TIME INTERVAL TO BE PRINTED"
211 INPUT "ENTER DT, NT, PT"; DT, NT, PT
212 PRINT #1, "THE TIME INCREMENT, THE TOTAL NUMBER OF INCREMENTS, AND THE PRINT TIMES
213 PRINT #1, "DT="; DT, "NT="; NT, "PT="; PT
300 TOTQ=O! 'THIS IS THE INTEGRATED HEAT LOSS
400 DR=(RZ-RA)/S : ZDR=(ZRZ-ZRA)/ZS 'THIS IS THE INCREMENT IN THE RADIUS BETWEEN NODES
420 I1=RA/DR : ZI1=ZRA/ZDR 'VALUE OF FIRST NODE, MEASURING FROM ORIGIN IN UNITS OF DR
421 QI1P=1+1/(2*I1) : ZQI1P=1+1/(2*ZI1)
422 GI1M=1-1/(2*I1) : ZQI1M=1-1/(2*ZI1)
423 GI2P=1+1/(2*(I1+S)) : ZQI2P=1+1/(2*(ZI1+ZS))
424 QI2M-1-1/(2*(I1+S)) : ZQI2M=1-1/(2*(2I1+ZS))
426 SM=S-1 : ZSM-ZS-1
430 AA=HK/(HD*HC) : ZAA=ZHK/(ZHD*ZHC) 'THIS IS THE THERMAL DIFFUSIVITY
500 BB=AA*DT/DR^2 : ZBB--ZAA*DT/ZDR^2 'STABILITY FACTORS FOR DIFFERENCE EQUATIONS BELOW
510 PRINT #1, "THE STABILITY FACTOR IS"; BB, ZBB
511 REM THE STABILITY FACTOR MUST BE LESS THAN 0.5
520 IF BB>=.5 GOTO 211
521 IF ZBB>=.5 GOTO 211
550 SGM=.000000056697# 'THE STEFAN-BOLTZMANN CONSTANT 5.6697D-08
551 TP=373 'THE POT TEMPERATURE IN DEGREES KELVIN
552 FV1=(CH/RA)^2+2!
553 FV-RA*(1!-.5*(FV1-(FV1^2-4!)^.5))/(2!*CH) 'THE RADIANT VIEWFACTOR BETWEEEN THE FIREBED AND S
TOVE WALL
554 PRINT #1, "THE VIEWFACTOR IS "; FV
560 FOR I-0 TO S STEP 1 'SET THE TEMPERATURES TO AMBIENT
561 TT(I)=TA
562 Tn(I) =TA
563 NEXT I
570 FOR ZI=O TO ZS STEP 1
571 ZTT(ZI)=TA : ZTN(ZI)=TA
572 NEXT ZI
600 BA=2!*DR*HA/HK 'THIS FACTOR IS FOR THE INTERIOR SURFACE CONVECTIVE HEAT TRANSFER
630 P=1! 'P IS A TALLY SO THAT VALUES ARE PRINTED WHEN EACH PT-th VALUE IS REACHED
649 SZS=S + ZS + 1
650 PRINT #1, " TIME ";'COLUMN HEADING
651 FOR JS=O TO SZS STEP 1 'COLUMN HEADINGS
652 PRINT #1, "TEMP";JS;
653 NEXT JS
654 PRINT #1, " HEAT LOSS"; 'COLUMN HEADING
655 PRINT #1, " TOTAL " 'COLUMN HEADING
700 FOR N-1 TO NT STEP 1 'ITERATE THROUGH THE VALUES OF TIME
705 REM CALCULATE THE INTERIOR WALL SURFACE TEMPERATURE
708 REM THE FACTOR .5*TF USED 70 ACCOUNT FOR FIRE BEING LIMITED TO CENTER HALF DIAMETER OF
STOVE, ITS SELF SHIELDING, AND OTHER FACTORS REDUCING ITS RADIANT FLUX TOWARD THE WALL. THE
SAME VIEWFACTOR HAS BEEN USED REGARDLESS.
709 BAR=2!*DR*SGM*FV*(.5*TF^4+TP^4-2!*TT(0)^4)/HK 'INTERIOR RADIATIVE HEAT TRANSFER
710 TN(0)=BB*(QIIM*(TT(1)+BAR+BA*(TG-TT(0)))-2*TT(0)+Q11P*TT(1))+TT(0)
740 SM=S-1
750 FOR 1=1 TO SM STEP 1 'CALCULATE THE TEMPERATURES FOR THE NODES INSIDE THE WALL SUCCESSIVELY
755 12=1/(2*(I1+I))
760 TN(I)=BB*((1-12)*TT(I-1)-2*TT(I)+(I+I2)*TT(I+1))+TT(I)
765 NEXT I
791 REM CALCULATE THE EXTERIOR WALL SURFACE TEMPERATURE
792 BZ=(2!*DR/HK)*3.93*(ZRA-RZ)^-.1389*CH^-.1111*(TT(S)-ZTT(0))^.25/(TT(S)+ZTT(0))^.3171
'EXTERIOR CONVECTIVE HEAT TRANSFER COEFFICIENT
793 REM THE VIEWFACTOR TO THE OUTER WALL IS 1.0
794 BZR=2!*DR*EE*SGM*(TT(S)^4-ZTT(0)^4)/HK 'EXTERIOR RADIATIVE HEAT TRANSFER
795 TN(S)=BB*(QI2M*TT(SM)-2*TT(S)+QI2P*(TT(SM)-BZR+BZ*(ZTT(0)-TT(S))))*TT(S)
809 ZBAR=2!*ZDR*EE*SGM*(TT(S)^4-ZTT(0)^4)/ZHK 'INTERIOR RADIATIVE HEAT TRANSFER
810 ZTN(0)=ZBB*(ZQI1M*(ZTT(1)+ZBAR+BZ*(TT(S)-ZTT(0)))-2*ZTT(0)+ZQI1P*ZTT(1))+ZTT(0)
850 FOR ZI=1 TO ZSM STEP 1 'CALCULATE TEMPERATURES FOR NODES INSIDE WALL SUCCESSIVELY
855 Z12--1/(2*(ZII+I))
860 ZTN(ZI)=ZBB*((I-ZI2)*ZTT(2I-1)-2*ZTT(ZI)+(1+Z12)*ZTT(ZI+1))+ZTT(ZI)
865 NEXT ZI
891 REM CALCULATE THE EXTERIOR WALL SURFACE TEMPERATURE
892 ZBZ=2!*ZDR*1.42*(ZTT(ZS)-TA)^.25/(ZHK*CH^.25) 'EXTERIOR CONVECTIVE HEAT TRANSFER COEFFICIEN
T
893 REM THE VIEWFACTOR TO AMBIENT IS 1.0
894 ZBZR=2!*ZDR*ZEE*SGM*(ZTT(ZS)^4-TA^4)/ZHK 'EXTERIOR RADIATIVE HEAT TRANSFER
895 ZTN(ZS)=ZBB*(2Q12M*ZTT(ZSM)-2*ZTT(ZS)+ZQI2P*(ZTT(ZSM)-ZBZR+ZBZ*(TA-ZTT(ZS))))+ZTT(ZS)
900 REM CALCULATE THE HEAT LOSS INTO THE INNER WALL OF THE COMBUSTION CHAMBER.
901 QQ=-CH*HK*RA*6.283185#*(TN(1)-TN(0))/DR
902 TOTQ=TOTQ+QQ*DT
905 X=P*PT
910 IF N<X GOTO 1000 'CHECK IF VALUE OF PT IS CROSSED AND WHETHER TO PRINT NODE TEMPERATURES
920 QT-N*DT/60 'THE TIME IN MINUTES
925 PRINT #1, USING "####.##" ; QT;
930 FOR IZ=O TO S STEP 1
936 PRINT #1, USING "#####.#" ; TN(IZ);
937 NEXT IZ
938 FOR ZI=O TO ZS STEP 1
939 PRINT #1, USING "#####.#" ; ZTN(ZI);
940 NEXT ZI
948 PRINT #1, USING "#######.##"; QQ;
949 PRINT #1, USING "#######.#"; TOTQ
950 P=P+1 'SET P TO PICK OUT NEXT VALUE PT FOR PRINTING
1000 FOR I=O TO S STEP 1
1010 TT(I)=TN(I) 'SET TEMPERATURES FOR NEXT ITERATION
1020 NEXT I
1030 FOR ZI-0 TO ZS STEP 1
1032 ZTT(ZI)=ZTN(ZI)
1034 NEXT ZI
1100 NEXT N
1499 BEEP
1500 END
Lire la suite 
Réponse
+0
moins plus
Salut.
C'est quoi ta question au juste? Tu es sur que c'est du fortran? on dirai plutot du basic. Si c'est bien du fortran, c'est pas du 77, mais c'est du combien?
giser- 1 avril 2006 à 10:46
Salut Char, si je peux me pardonner, ce prgogramme m'aide à comprendre le language Matlab et c'est un ancien programme que je ne connais pas alors c'est peut etre du basic mais moi je voyais que ça ressemble au Fortran.
Bonne comprehension.
Répondre
Ajouter un commentaire
Réponse
+0
moins plus
Voilà ; j espere que tu connais les notion de conduction thermique, ton pgm est en basic pas en fortran , puis envoie moi le probleme mathematique et les conditions limites et initiale je t enverais le code en matlab.

Samus
Ajouter un commentaire
Réponse
+0
moins plus
Bonjour,


J'étudie en ce moment le problème de la conduction thermique sur Matlab et je voudrais savoir si vous pouviez m'envoyer svp le code en matlab sur l'adresse email elmansourisiham@yahoo.fr

C'est urgent car on a un projet à rendre !!! Merci beaucoup !!
Ajouter un commentaire
Ce document intitulé «  Besoin d'aide:programmer en Matlab ou en C++  » issu de CommentCaMarche (www.commentcamarche.net) est mis à disposition sous les termes de la licence Creative Commons. Vous pouvez copier, modifier des copies de cette page, dans les conditions fixées par la licence, tant que cette note apparaît clairement.

Vous n'êtes pas encore membre ?

inscrivez-vous, c'est gratuit et ça prend moins d'une minute !

Les membres obtiennent plus de réponses que les utilisateurs anonymes.

Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes.

Le fait d'être membre vous permet d'avoir des options supplémentaires.