Question: #8914

Pre Lab 4 CS 122L Complete Solution

Pre-Lab 4

CS 122L - 5 Points Total

 

Objectives

●     Learn how to graph functions

 

●     Learn various styles that can be applied to graphing

 

Deliverables

●     Submit your pre-lab answers in Bblearn under the Lab 4 pre-lab assignment area prior to the start of class.

 

We want to plot the function y = x2 over the interval [1,3]. In order to do this, we need to establish an x vector (our independent variable) and a y vector (our dependent variable).

 

1) Given x = [1:0.05:3], write the MATLAB code to generate our y vector (Hint: refer to the original function that we are trying to plot).

 

2) There are many different line specifications that can be used when plotting. Using the documentation at http://www.mathworks.com/help/matlab/ref/linespec.html, answer the following questions:

 

a) List 2 different line style specifiers, and the line style that they produce (e.g., ‘-’ is the default solid line).

 

b) List 2 different color style specifiers and the color they produce (e.g., ‘k’ is used to specify black).

 

c) List 2 different marker specifiers and the markers the produce (e.g., ‘p’ is used to specify pentagram markers)

 

3) Using your answers to questions 1 and 2, write the MATLAB code to plot y = x2. Be sure to use some of the line specifications that you discussed for question 2.

Solution: #8942

Pre-Lab 4 CS 122L Complete Solution

a. Matlab Line Specification. '--' Dashed line ':' Dotted line '-.' Dashed-dot l...
Tutormaster
Rating: A+ Purchased: 11 x Posted By: Vikas
Comments
Posted by: Vikas

Online Users