Course Name: Computer Programming Course Code: (EE26324) Semester: 1st 1446/1447 Group Number: …………… University of Bisha College of Engineering Electrical Engineering Department Student Name: ………………………… Lab #4 Date of Issue: 14/09/2024 ID Number: ………………………… Due Date of Submission: 7/10/2024 Notes: Student must do his homework independently and submit it within the allowable time. Late submission is not accepted. Cheating is considered a most serious offence, and we shall not hesitate to take the appropriate punitive actions according to the severity of the offence committed and including expulsion from the program. Question #1 (draw line graph using plot command) a) Create a plot that connects the points with red color & dashed line, with circles as markers. The line width is 2 points, and the size of the markers is 12 points. The markers have a blue edge line and yellow filling. X 1980 1985 1990 1995 2000 2005 2010 2015 2020 Y 8 12 20 22 18 24 27 15 21 The label for the X-axis is “ Time in Years ” The label for the Y-axis is “ Population in Millions ” The title of the plot is “Population Changes Every Five Years” The plot must include a Grid and Legend. b) Repeat the above plot but focus on the X-axis from 1990 to 2015, and the Y-axis from 18 to 27 Note: Question 2: (Plot polynomials using plot & polyval commands) Consider X as a vector starts at 0 and ends at 6 with increment 0.5 Consider Y as a vector = 3 X3 – 26 X + 6 Consider U as a vector = 9 X2 + 18 Consider V as a vector = 18 X Draw the relation between X and Y, X and U, X and V. The first relation with blue color & solid line, with square as markers. The line width is 3 points, and the size of the markers is 10 points. The markers have a black edge line and yellow filling. The second relation with green color & dash-dot line, with triangle pointed up as markers. The line width is 3.5 points, and the size of the markers is 11 points. The markers have a blue edge line and cyan filling. The third relation with magenta color & dotted line, with circles as markers. The line width is 3 points, and the size of the markers is 10 points. The markers have a red edge line and black filling. Choose the proper label for the X-axis and Y-axis. The title of the plot is “Plotting three curves in one figure”. The plot must include a Grid and Legend. Write the MATLAB command to do this and give the screen shot of the MATLAB plot. Computer Programming - EE26324 1 Question 3: (Plot functions using fplot command) Write the suitable MATLAB commands to plot the two curves (x and y) w.r.t. time (t) that starts at t = 0 and ends at t = 8. Your plot must include labels, title, legend. Take: 𝒙(𝒕) = 𝟏𝟎 𝐞−𝟎.𝟓𝐭 𝐬𝐢𝐧(𝟑𝐭 + 𝟐) , 𝒚(𝒕) = 𝟕 𝐞−𝟎.𝟒𝐭 𝐜𝐨𝐬(𝟓𝐭 − 𝟑) Question 4: (Plot multiple graphs in the same figure using subplot command) Given that: X has 100 numbers between 0 & 2π Y = sin X, Z = cos X, V= Y2 and W = Z2 We need to plot X versus Y & X versus Z & X versus V & X versus W. Use MATLAB to plot the above four relations in same figure using the command subplot. Give a screenshot of MATLAB code and MATLAB response. Question 5: (bar plot using bar command) a) Create a Vertical Bar plot that show the relation between the years (X) and population (Y) given below X Y 1980 8 1985 12 1990 20 1995 22 2000 18 2005 24 2010 27 2015 15 2020 21 The label for the X-axis is “ Time in Years ”. The label for the Y-axis is “ Population in Millions ”. The title of the plot is “Population Every Five Years”. Question 6: (3D plot using plot3 command) Given that the time (t) has 1000 points between −10 and +10, and 𝑥(𝑡) = 𝑒 −𝑡/10 sin(5𝑡) 𝑦(𝑡) = 𝑒 −𝑡/10 cos(5𝑡) Using MATLAB, draw a three-dimensional plot where time (t) is represented on Z axis, the function x(t) is represented on X axis and the function y(t) is represented on Y axis. Give a proper label to each axis. Your answer must include a screenshot of MATLAB code and MATLAB response. Question 7: (3D plot using surf command) Given that the X-axis starts at 1 with increment 0.05 and ends at 10. Similarly, the Y-axis starts at 1 with increment 0.1 and ends at 20. The Z axis is defined by the function: 𝑍 = sin(𝑥) + cos(𝑦) Draw the surface plot and give proper labels to the 3 axes and title for that plot. Your answer must include a screenshot of MATLAB code and MATLAB response. With Best Wishes Computer Programming - EE26324 2