forked from smallbasic/smallbasic.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path124.bas
More file actions
52 lines (49 loc) · 1.32 KB
/
Copy path124.bas
File metadata and controls
52 lines (49 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
'#sec:Main
100 input "Ganancia? (10)",kp:if (kp=0) then kp=10
110 input "Integracion?(5) ",ti:if (ti=0) then ti=5
120 input "Factor Derivativo? (1) ",td:if (td=0) then td=1
121 input "Ancho Disturbac.? (80) ",wd:if (ancho=0) then wd=80
122 kp=kp/10:ti=ti/10:td=td/10
180 rf=40:x=0:ra=40
190 rao=40:amo=40
200 cls
201 a$=str$(kp*10)
202 a$=a$+" "+str$(ti*10)+" "
203 a$=a$+str$(td*10)
204 locate 0,0:print a$
210 cx=0:ci=0
230 t=2:s=0
240 ea=rf-ra:e=rf-ra
250 s=e+s
255 x=x+1:if (x>159) then goto 358
260 u=kp*(e+(s/ti)+((e-ea)/t)*td)
282 if (u>150) then u=150
284 if (u<-150) then u=-150
290 ea=e
310 xu=(u*0.1)
320 rao=ra:ra=ra+xu
330 uu=int(u*10)/10
332 rr=int(ra*10)/10
350 a$=str$(int(u))+" "+str$(int(rf))
352 a$=a$+" "
355 at 1,0:print a$
357 color 9:line x,159-ra,x-1,159-rao
358 g$=inkey$:color 0
360 if g$="k" then input "Nuevo kp?",kp:kp=kp/10:goto 180
362 if g$="a" then input "Nuevo ancho?",wd:goto 180
364 if g$="i" then input "Nuevo ti?",ti:ti=ti/10:goto 180
368 if g$="d" then input "Nuevo td?",td:td=td/10:goto 180
375 if g$="a" then goto 180
380 if g$="q" then goto 100
390 mx=40+wd
400 if ((x<40) or (x>mx)) then amo=40:amp=40:goto 420
405 ang=(x-40)*(180/wd)
406 ang=ang/57.29578
410 se=sin(ang)
415 amo=amp:amp=(80*se)+40
416 color 12
420 line x,159-amp,x-1,159-amo
421 color 0
430 rf=amp
500 goto 240
'