CODINGLISTINGS ★ Wave Interference ★

Graphic - Wave Interference|Popular Computing Weekly)Coding Listings
 ★ Ce texte vous est présenté dans sa version originale ★ 
 ★ This text is presented to you in its original version ★ 
 ★ Este texto se le presenta en su versión original ★ 
 ★ Dieser Text wird in seiner ursprünglichen Fassung Ihnen präsentiert ★ 

Super simulation

Making waves on any Amstrad machine - from the keyboard of John Kennedy

This program simulates the superposition of light - that is the resultant wave formed by two combined incident waves. It should be of interest to physics students as it shows constructive and destructive interference in a simple and easily understood manner. When the program is run, it will ask for some data. The user should enter the wavelength of the two waves, noting that only wavelengths between 1 cm and 1 m are accepted. The computer will then ask for the wave offset. This is the number of degrees that B is ahead of A, eg 180 is half a wavelength ahead; 90 is a quarter; 0 and 360 will produce a zero offset.

The program will then draw a grid in which each square represents 1 cm and with a horizontal axis across from left to right representing zero displacement. The waves and their resultant will be drawn out in different colours and then made to flash, highlighting the two sets. Pressing space at this point will re-run the program. Some example input data is given above.

Wavelengths Offset  Result
8 and 5      180    destructive 
5 and 5      0      constructive
5 and 5      90     mixture
2 and 1.5    0      'beats'

Beats are the regular changes in the amplitude of the resultant waves. They can be heard when two sound sources of similar amplitude but slightly different wavelength are used. Even the sound generator of the Amstrad will cause beats, try; Sound 1,1500,30000 followed by Sound 2,1601,30000.

Program Notes

The program has so many REM statements notes are almost unnecessary.

Line

  • 70 If progam broken into, re-run.
  • 150-540 Get data from user.
  • 490-630 Draw grid and axis.
  • 640-770 Draw actual waves.
  • 780-950 Re-run?
  • 960-970 On error routine.

PopularComputingWeekly850502

★ PUBLISHER: POPULAR COMPUTING WEEKLY
★ YEAR: 1985
★ AUTHOR: John Kennedy

CPCrulez[Content Management System] v8.75-desktop/c
Page créée en 043 millisecondes et consultée 474 fois

L'Amstrad CPC est une machine 8 bits à base d'un Z80 à 4MHz. Le premier de la gamme fut le CPC 464 en 1984, équipé d'un lecteur de cassettes intégré il se plaçait en concurrent  du Commodore C64 beaucoup plus compliqué à utiliser et plus cher. Ce fut un réel succès et sorti cette même années le CPC 664 équipé d'un lecteur de disquettes trois pouces intégré. Sa vie fut de courte durée puisqu'en 1985 il fut remplacé par le CPC 6128 qui était plus compact, plus soigné et surtout qui avait 128Ko de RAM au lieu de 64Ko.