Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

02 atiqa ijaz khan 04

922 views

Published on

MATLAB, FOR loops, WHILE loops, Vectors, Matrix, IF- Else Statements

Published in: Education, Technology, Spiritual
  • Be the first to comment

  • Be the first to like this

02 atiqa ijaz khan 04

  1. 1. Atiqa Ijaz Khan Roll no. 02 1 Inst. Of Geology, PU Assignment-4 Submitted To: Sir. Imran Ali Memon Dated: 29th March, 2014 Question.1:
  2. 2. Atiqa Ijaz Khan Roll no. 02 2 Inst. Of Geology, PU Question 2:
  3. 3. Atiqa Ijaz Khan Roll no. 02 3 Inst. Of Geology, PU Question 3: Question 4:
  4. 4. Atiqa Ijaz Khan Roll no. 02 4 Inst. Of Geology, PU
  5. 5. Atiqa Ijaz Khan Roll no. 02 5 Inst. Of Geology, PU Question. 5:
  6. 6. Atiqa Ijaz Khan Roll no. 02 6 Inst. Of Geology, PU Question 6:
  7. 7. Atiqa Ijaz Khan Roll no. 02 7 Inst. Of Geology, PU Question No.7: Question 8:
  8. 8. Atiqa Ijaz Khan Roll no. 02 8 Inst. Of Geology, PU Question 9: What is the difference between While and For loop. Justify your answer with example. 1. FOR LOOPS: The for statement, or the for loop, is used when it is necessary to repeat statement (s) in a script or function, and when it is known ahead of time how many times the statements will be repeated. The statements that are repeated are called the action of the loop.
  9. 9. Atiqa Ijaz Khan Roll no. 02 9 Inst. Of Geology, PU 2. WHILE LOOPS: The while statement is used as the conditional loop in matlab; it is used to repeat an action when ahead of time it is not known how many times the action will be repeated. Here is a while loop which divides a number by 2 over and over until the result is less than or equal to 1. Think "while the number is greater than 1, keep dividing." Furthermore this code only prints the final result.
  10. 10. Atiqa Ijaz Khan Roll no. 02 10 Inst. Of Geology, PU Question. 10: What is the difference between matrix and structure in Matlab. Justify your answer with example. FOR MATRIX: The dimensions of Matrix is ‘r by c’, also known as 2D array. It takes only NUMERIC data type! FOR STRUCTURES: A structure is a data type that groups’ related data using data containers called fields. Each field can contain data of any type or size. A struct array has the following properties: 1. All structs in the array have the same number of fields. 2. All structs have the same field names. 3. Fields of the same name in different structs can contain different types or sizes of data.
  11. 11. Atiqa Ijaz Khan Roll no. 02 11 Inst. Of Geology, PU

×