Lesson 13: Advanced Graphics

Objective

  • To learn how MATLAB handles the image files.
  • To learn how to create an animation.

Background

Questions

You just need to submit the final figure for each question.

  1. Create a plot of the function: \(y = \sin (x)\) for x from \( - 2\pi \) to \( + 2\pi \)
    Assign the plot an object name (handle), and use the handle with appropriate dot nomenclature to change the following properties (if you aren't sure what the object name is for a given property, use the get function to see a list of available property names):
    1. Line color from blue to green
    2. Line style to dashed
    3. Line width to 2
  2. Assign a handle to the figure created in Question 1, and use the dot nomenclature to change the following properties (if you aren't sure what the object name is for a given property, use the get function to see a list of available property names):
    1. Figure background color to red
    2. Figure name to "A Sine Function"
  3. Assign a handle to the axes created in Question 1, and use dot nomenclature to change the following properties (if you aren't sure what the object name is for a given property, use the get function to see a list of available property names):
    1. Background color to blue
    2. x-axis scale to log
  4. Create an animation of the following pesudo code:
    Let x vary from \( -2\pi \) to \( +2\pi \)
    Let \( y = sin(x) \)
    Mesh x and y: [x,y] = meshgrid(x,y);
    Let a be the animation variable from 0 to \(8\pi\) with increment \(\pi / 10\).
    Using a for-loop from 1 to the length of the a
        Let \( z = sin(x-a) cos(y-a) \)
        Draw the z value using surf(z) function
        Using drawnow function to update the graphic.
        (Optional) You can add a delay function: pause(0.1)
© 2024 Air Supply Information Center (Air Supply BBS)