Permutation and Bit Strings

Only available on StudyMode
  • Download(s) : 621
  • Published : April 4, 2011
Open Document
Text Preview
1) A small rocket is being designed to make wind shear measurements in the vicinity of thunderstorms. Before testing begins, the designers are developing a simulation of the rocket's trajectory. They have derived the following equation that they believe will predict the performance of the test rocket, where t is time elapsed in seconds. The equation gives the height above the ground level at time t. The first term (60) is the height above ground level of the nose of the rocket. height = 60 + 2.13t^2 − 0.0013t^4 + 0.0003t^4.571

a) Write a program to compute and print the time and height of the rocket from t = 0 to the time that it hits the ground, in increments of 2 secs. If the rocket has not hit the ground within 100 secs, stop the program. b) Modify the program such that instead of a table, the program prints the time at which the rocket begins falling back to the ground and time at which the rocket impacts.

2. Given a string of characters, we can permute the individual characters to make new strings. If we can impose an ordering on the characters (say alphabetic sequence),then the strings themselves can be ordered and any given permutation can be given a unique number designating its position in that ordering. For example the string `acab' gives rise to the following 12 distinct permutations: Thus the string `acab' can be characterized in this sequence as 5. Write a MATLAB program that will read in a string and determine its position in the ordered sequence of permutations of its constituent characters. Input and Output

Input will consist of a series of lines, each line containing one string. Each string will consist of up to 30 lower case letters, not necessarily distinct. Output will consist of a series of lines, one for each line of the input. Each line will consist of the position of the string in its sequence. Sample input

Sample output
3 The Hamming distance between two strings of bits (binary integers)...
tracking img