multiple-plots/questions.rst
author Puneeth Chaganti <punchagan@fossee.in>
Wed, 20 Oct 2010 16:19:55 +0530
changeset 341 9f7eb1ed0e08
parent 311 3f942b8d3f2f
permissions -rw-r--r--
Merged heads.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
311
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     1
Objective Questions
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     2
-------------------
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     3
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     4
.. A mininum of 8 questions here (along with answers)
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     5
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     6
1. Multiple plots appear in different figures by default. True or False?
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     7
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     8
   Answer: False
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     9
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    10
#. What command is used to get individual plots separately?
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    11
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    12
   Answer: Figure
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    13
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    14
#. Which figure is closed after the following commands are run? 
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    15
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    16
:: 
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    17
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    18
  x = linspace(0, 50, 500)
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    19
  figure(1)
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    20
  plot(x, sin(x), 'b')
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    21
  figure(2)
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    22
  plot(x, cos(x), 'g')
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    23
  xlabel('x')
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    24
  ylabel('cos(x)')
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    25
  close()
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    26
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    27
  Answer: Figure 2
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    28
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    29
#. Describe the plot obtained by the following commands::
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    30
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    31
  x = linspace(0, 50, 500)
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    32
  subplot(2, 1, 1)
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    33
  plot(x, sin(x), 'b')    
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    34
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    35
Answer: A figure window with space for 2 plots one below the other is
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    36
        obtained. The sine plot with blue line appears in the first row. 
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    37
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    38
#. Describe the plot obtained by the following commands::
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    39
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    40
  x = linspace(0, 50, 500)
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    41
  subplot(2, 1, 1)
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    42
  plot(x, sin(x), 'b')
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    43
  subplot(2, 1, 2)
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    44
  plot(x, cos(x), 'g')
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    45
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    46
  Answer: 2 plots one below another. sine in blue on first row. cosine
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    47
  in green in the second row. 
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    48
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    49
#. Describe the plot obtained by the following commands::
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    50
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    51
  x = linspace(0, 50, 500)
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    52
  subplot(2, 1, 1)
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    53
  plot(x, sin(x), 'b')
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    54
  subplot(2, 1, 2)
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    55
  plot(x, cos(x), 'g')
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    56
  subplot(2, 1, 1)
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    57
  plot(x, tan(x), 'r')
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    58
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    59
  Answer: 2 plots one below another. tan in red on first row. cosine
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    60
  in green in the second row. 
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    61
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    62
  
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    63
#. Which of the following gives the correct legend for the commands below
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    64
   
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    65
   a. legend([sin, cos, tan])
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    66
   #. legend([tan, cos, sin])
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    67
   #. legend[(tan, cos, sin)]
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    68
   #. legend(['sin', 'cos', 'tan'])
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    69
   #. legend(['tan', 'cos', 'sin'])
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    70
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    71
::
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    72
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    73
  x = linspace(0, 50, 500)
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    74
  figure(1)
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    75
  plot(x, sin(x), 'b')
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    76
  figure(2)
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    77
  plot(x, cos(x), 'g')
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    78
  figure(3)
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    79
  plot(x, tan(x), 'b')
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    80
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    81
   Answer: legend(['tan', 'cos', 'sin'])
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    82
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    83
Larger Questions
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    84
----------------
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    85
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    86
.. A minimum of 2 questions here (along with answers)
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    87
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    88
1. Question 1
3f942b8d3f2f Multiple plots LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    89
2. Question 2