Presentation is loading. Please wait.

Presentation is loading. Please wait.

EGR 115 Introduction to Computing for Engineers

Similar presentations


Presentation on theme: "EGR 115 Introduction to Computing for Engineers"— Presentation transcript:

1 EGR 115 Introduction to Computing for Engineers
2D Plotting – Part II Lecture 11 EGR 115 Introduction to Computing for Engineers

2 EGR 115 Introduction to Computing for Engineers
Lecture Outline Annotation of Plots Polar, Bar, Pie, … Plots Lecture 11 EGR 115 Introduction to Computing for Engineers

3 2D Plotting Annotation of Plots
Plot 𝑦 𝑡 =10 𝑒 − 𝑡 𝜏 sin 𝜔 𝑡 : Plot limits should be 0<t<2𝜋 (in sec) for the 𝑥-axis and −10<𝑦< 10 for the 𝑦-axis. Overlap three different plots, one for each of 𝜏= 1, 3, 10 . Angular velocity is 𝜔=3 rad/sec. Include the function definition in the legend. Include axis labels and a title Turn on grid lines Colors as shown Publish as ‘Quiz2_Last_First.docx’ Upload to hwk#3 Lecture 11 EGR 115 Introduction to Computing for Engineers

4 2D Plotting Annotation of Plots
Editing a Plot Click on “Edit Plot” Right click on the red line and make it dashed Click on the “Show Plot Tools” (far right) icon Select an item in the plot window to see properties of that item. Change the location of the legend to be the lower left corner Lecture 11 EGR 115 Introduction to Computing for Engineers

5 2D Plotting Additional 2D Plots
A Vertical Bar Graph: MATLAB Code: %% An in class example of Additional Plots x=[ ]; y = 10 * rand(1, length(x)); % Bar Plot figure bar(x,y) title('Example of a Vertical Bar Plot') xlabel('x') ylabel('y') Lecture 11 EGR 115 Introduction to Computing for Engineers

6 2D Plotting Additional 2D Plots
A Horizontal Bar Graph: MATLAB Code: barh(x,y) title('Example of a Horizontal Bar Plot') xlabel('y') ylabel('x') Lecture 11 EGR 115 Introduction to Computing for Engineers

7 2D Plotting Additional 2D Plots
A Stem Graph: MATLAB Code: stem(x,y) title('Example of a Stem Plot') xlabel('x') ylabel('y') Lecture 11 EGR 115 Introduction to Computing for Engineers

8 2D Plotting Additional 2D Plots
A Stair Graph: MATLAB Code: stairs(x,y) title('Example of a Stair Plot') xlabel('x') ylabel('y') Lecture 11 EGR 115 Introduction to Computing for Engineers

9 2D Plotting Additional 2D Plots
A Compass Plot: MATLAB Code: compass(x,y) title('Example of a Compass Plot') xlabel('x') ylabel('y') Lecture 11 EGR 115 Introduction to Computing for Engineers

10 2D Plotting Additional 2D Plots
A Pie Graph: Explain the percentages in the chart pie(y) title('Example of a Pie Plot') Lecture 11 EGR 115 Introduction to Computing for Engineers

11 2D Plotting Additional 2D Plots
An Exploded Pie Graph: explode = [ ]; pie(y, explode) title('Example of an Exploded Pie Plot') Lecture 11 EGR 115 Introduction to Computing for Engineers

12 2D Plotting Additional 2D Plots
Generate a plot of (i.e., plot(x, y)): y= 2 − 𝜙 2𝜋 𝑆𝑖𝑛 𝜙 vs 𝑥= 2 − 𝜙 2𝜋 𝐶𝑜𝑠 𝜙 , for 0≤𝜙≤2𝜋 When 𝜙=0 => y = ? and x = ? Reproduce the same as a polar plot: polarplot(theta, r) What is the expression for r and what is  ? Recall that: 𝑥+𝑖 𝑦=𝑟  𝑒 𝑖𝜃 MALAB CODE Lecture 11 EGR 115 Introduction to Computing for Engineers

13 EGR 115 Introduction to Computing for Engineers
Next Lecture Designing The Sudoku Game in MATLAB Lecture 11 EGR 115 Introduction to Computing for Engineers


Download ppt "EGR 115 Introduction to Computing for Engineers"

Similar presentations


Ads by Google