EENG 1910: Project I – Introduction to Electrical Engineering

Assignment-9

 

To copy the resulting figures in the problems below to Word, Click Edit on the figure window, then Copy Figure and paste into your Word document.

 

 

Problem-1: Plotting in Different Figure Windows

 

Plot sin(x) for x values ranging from 0 to 2 (use the linspace function or column operator) in two separate figure windows (Use figure(1), figure(2))

 

  • using 10 points in this range
  • using 100 points in this range

 

Annotate your figures and provide an explanation of the difference observed in the two figures.

 

 

Problem-2: Subplot

 

Use subplot to show the difference between the sin and cos functions. Create an x vector with 100 linearly spaced points in

 

the range from –2 to 2 , and then two y vectors (y1 and y2) for sin(x) and cos(x). In a 2×1 subplot, use the plot function to display them, with appropriate titles.

 

 

 

 

Problem-3: Plotting, Labelling, Hold On/Off

 

Plot = exp(  ) in the interval [-3, 3] using a solid line. Now plot a linear approximation of (i.e. = ) using a dashed line with a square marker in a different color and a quadratic

approximation  of           (i.e.      = 1 +               + 22)  using  a  dotted  line  and  a

circle marker in another color. Title the plot “Plots of Approximations of exp(  ).” Label the y-axis as “Approximations

 

of exp(  )” and the x-axis as “ ”. Use legend to appropriately identify the plotted lines. Set axes limits to [-3, 3, -5, 15].

 

Note: Make sure to define with sufficient data points to avoid obtaining choppy curves. Use hold on/hold off to obtain the three curves on the same figure.

 

 

Problem-4: Bar Chart, Histogram, Subplot

 

Let the vector

 

Grades = [68, 83, 61, 100, 80, 95, 45, 100, 70, 75, 82, 57, 5, 76, 85, 62, 71, 96, 78, 76, 68, 72, 75, 83, 87, 89, 99, 93, 100, 100, 80, 96, 100, 98, 45, 96, 89, 86, 99, 90, 70]

 

represent the distribution of final grades in an engineering course.

 

  1. Use MATLAB to sort (sort) the grades. Then, using the subplot function subdivide the figure window into two rows and one column that shows the following:

 

  • A bar (bar) graph of the sorted scores,

 

  • A histogram (hist) of the sorted scores.

 

  1. Using length or numel along with the find function, provide the command that will return the number of students that received A, B, C, D, and F in this class assuming that A corresponds to grades greater or equal to 90, B corresponds to grades greater or equal to 80 but less than 90, etc.

 

The results should be displayed in statements as the ones below:

 

9 students received A in this class.

 

8 students received B in this class.

.

 

Note: Annotate the resulting figure appropriately.

 

 

 

 

 

 

 

Problem-5: Subplot

 

Create a MATLAB script to plot the functions defined below provided x = 0:pi/20:2*pi. All the plots should be on the same figure in the format of a 2-by-2 matrix. Each of the subfigures should have a title, and labels.

 

f1(x) = cos(x)

f2(x) = sin(2*x)*sin(3*x)

 

f3(x) = 1/cos(2*x)

 

f4(x) = cos(x^2) + 2*sin(x^2)

 

Problem-6: Bar Chart

 

Let’s assume that the three lines of data below represent years, median incomes, and median home prices for the city of Dallas. The dollar amounts (median incomes and median home prices) are in thousands.

 

2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015

 

72 74 74 77 49 53 89 93 95 85 100 120

275 270 300 310 150 250 410 380 300 421 500 486

 

Create a horizontal stacked bar chart to display the above information, with an appropriate title.

 

The ratio of the home price to the income is called the “housing affordability index.” Calculate this for every year and plot it. The x-axis should show the years (e.g., 2004 to 2015). In what year(s) houses were affordable in Dallas? Why?

 

 

 

 

Problem-7: Pie Chart

 

The number of students in each engineering department at UNT is:

 

  • 255 CS 421 CE 376 ET 142 ME 98

 

Draw a pie chart to show the percentage of students in each department. Make sure that you have appropriate titles, labels, and legends on your chart.

 

What other chart could be used to represent this, and why?

 

Your output should be similar to the one in the figure below:

 

Problem-8: Testing

 

What is the importance of testing in engineering design? Provide couple examples of real-life situations or projects where thorough testing should have been performed and the consequences that resulted in poor testing.

 
"Looking for a Similar Assignment? Order now and Get 10% Discount! Use Code "Newclient"

"Our Prices Start at $11.99. As Our First Client, Use Coupon Code GET15 to claim 15% Discount This Month!!":

Get started