Plotting Examples for Problem Set 0

Plotting Examples for Problem Set 0 - MSE 310/ECE 340...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: MSE 310/ECE 340 Instructor: Bill Knowlton Examples of Plotting Functions ü Example 1: Using the command ListPlot[ ] to plot data in a scatter plot In[1]:= Initialize data Clear someData, somePlot Place data in list someData 1 17, 4270 , 1 50 , 1350 , 1 100 , 550 , 1 150 , 430 , 1 300 , 160 Create scatter plot of data somePlot ListPlot someData, Frame True, GridLines Automatic, PlotStyle RGBColor 1, 0, 0 , PointSize 0.02` , FrameLabel "y data arb. Units ", "x data arb. Units " Out[2]= 1 17 , 4270 , 1 50 , 1350 , 1 100 , 550 , 1 150 , 430 , 1 300 , 160 Out[3]= 0.01 0.02 0.03 0.04 0.05 0.06 1000 2000 3000 4000 y- data arb. Units x- data arb.Units ü Example 2: Using the command Plot[ ] to plot a function ã In the Input Cell below, I use the ideal gas law showing a direct relation with temperture, T, and an inverse relation with pressure and is given by: v p_, n_, T_ : n R T p Note that there are other variables, but they are not included in the bracket [ ]. The variables included in the [ ] are call Arguments allows us to vary or give a value directly for each variable in the [ ]. For more information, see Help Master Index [ ]. Lastly, to add a comment in the Input Cell that Mathematica will ignore, use (* comment *). I use this to document what I'm up to in the program. Clear v, R, T, p v p_, n_, T_ : n R T p Constants R 0.08206; atm L mol K Plots Plot v p, 1, 298 , p, 1, 10 , Frame True, GridLines Automatic, PlotStyle RGBColor 0, 0, 1 , FrameLabel "p atm ", "v L " , PlotLabel "v vs p for T 25 o C" Print "v: ", v 1, 1, 298 , "L at T 25 o C" 2 4 6 8 10 4 6 8 10 12 14 16 p atm v L v vs p for T = 25 o C v: 24.4539L at T 25 o C 2 Plotting Examples for Problem Set 0.nb ü Example 3: Plotting multiple plots of a funtion by creating a table of output using the command Table[ ] ã Plot your function over 2 variables. If I want to graphically examine a function in 2D but with 2 variables, one way I do so is Plot your function over 2 variables....
View Full Document

This note was uploaded on 10/16/2011 for the course ENGINEERIN MSE 310 taught by Professor Billknowlton during the Spring '10 term at Boise State.

Page1 / 14

Plotting Examples for Problem Set 0 - MSE 310/ECE 340...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online