Download presentation
Presentation is loading. Please wait.
1
John Federici NJIT Physics Department
Physics 114: Lecture 3 More MatLab Basic matrix/array operations for reading in data and for graphical output Info on finding Summer Research Image Data Cartoon and histograms Lecture04 APPLICATION: Write a basic MatLAB program to read in real data and make a plot John Federici NJIT Physics Department
2
TRIVIA QUESTION! Which “Big Bang Theory” character is from New Jersey?
(a) Raj Koothrappali (b) Bernadette Rostenkowski (c) Howard Wolowitz (d) Sheldon Cooper (e) Amy Farrah Fowler (f) Leonard Hofstadter (g) Penny a b c d e f g
3
Importing “REAL” Data into Matlab
Since we take data with instruments (not Matlab), we need to know how to import data into Matlab for further analysis and manipulation. Data import and export functions provide access to data from files, other applications, web services, and external devices. You can read popular file formats, such as Microsoft® Excel® spreadsheets, text, images, audio and video, and scientific data formats. Low-level file I/O functions let you work with data files in any format. For this class, we will focus on TEXT Files, EXCEL files, and IMAGE files There are two basic methods for importing data from files: Programmatically in the Command window (or via Matlab Script) Through File Import GUI
4
Importing Data via GUI Import Tool
Many possible File types!
5
Example of Data import Tool
Open Matlab and Use Import Tool to open Lecture3-SampleData.xls Demonstrate ability to import into different data formats Column Vector Array Demonstrate ability to change section of data for import Demonstrate ability to change name of variables Note in the IMPORT SELECTION button, you have the option for Import Data Generate Script Generate Function Class discussion: Which option would you choose? Under what circumstances?
6
Example of Data import Tool
Open Matlab and Use Import Tool to open Lecture3-SampleData.txt Demonstrate changing of delimiters and other options Variable Name Row parameter HINT: if you need to analyze LOTS of data which is ALL in the same format, consider Import Data – Option for the FIRST time you import data to make sure that import data is done correctly Generate Script/ Function – Now you can use the same code to import the data. The above suggestion also writes the MATLAB code you need! No need to figure out which functions to use!
7
Journal Quality Figures
Links to some good references (Google: how to make journal quality figures) - Good examples of Dos and Don’ts of making figures with excellent examples - Other examples of Do’s and Don’t s of making figures with examples. Ten simple rules for Better Figures – Journal article - How to use different software packages. Good reference for biophysics (ie. images) related figures.
8
Summary – The punch-line
Good graphic • Terms are spelled out • Text runs left to right • Data are clarified with small notes • Legends vs. labels –decide which one is appropriate • Graphic attracts viewer • Color choices (blue ‐ good) • Font type is clear, precise, modest • Upper & lower case, with serifs • Graphics should tend toward the horizontal, greater in length than height. – NOTE: Contradictory to other people’s Do’s Bad graphic • Excessive abbreviations to decode • Text in vertical or multiple directions • Graphic requires repeated references to scattered text • Repeated back and forth between legend and graphic required • Graphic is repellent, filled with chartjunk • Dark letters on dark contrast (Red & green) • Type is dense, heavy, overbearing • All upper case, sans serif *Tufte, Edward R. The Visual Display of Quantitative Information
9
Journal Quality - Intro
As researchers/ physicists, we spend a great deal of time, energy, and money acquiring or generating data. Part of the researcher’s job is to communicate your science and results to other people (colleagues, students, general public). It makes sense to treat the VISUAL presentation of data (eg. figures, graphs and charges) with the care and effort it requires to effectively present your message. As an analogy, why are students at technical universities such as NJIT REQUIRED to take history, humanities, philosophy,… ie. the Liberal Arts?
10
Journal Quality - Intro
The whole point of a plot/graph/image is to make a point—there is a narrative associated with them, and clarity of the idea is the justification for the graphic. Each plot/graph/image shown must have a purpose that cannot be met without it. Graphics are expensive, both in space taken and in color production costs. The graphic is there to convince! You are trying to entice the reader to believe your result. The graphic must be persuasive. An honest scientist (or writer) should be trying to be clear and objective. It is very easy to mislead with a graphic. Scientists should provide enough information that the reader can make an objective assessment of the truth of what they are seeing.
11
Graphical Excellence*
• Is the well‐designed presentation of interesting data – a matter of substance, of statistics, and of design • Consists of complex ideas communicated with clarity, precision, and efficiency • Is that which gives to the viewer the greatest number of ideas in the shortest time with the least ink in the smallest space • Is nearly always multivariate • Requires telling the truth about the data *Tufte, Edward R. The Visual Display of Quantitative Information
12
Figure Requirements for Applied Physics Letters
Follow link and look for info on graphics Figures: Figures should highlight, clarify, and summarize data and results. They must be legible, with clear graphics, easily understood axis and labels, and well composed captions. For detailed information on preparing figures see our Instructions for Preparing Graphics. Reviewers can REJECT your paper because of the poor quality of figures and captions.
13
What are Good Graphics? Graphics that communicate ideas with:
– Clarity • Lack of ambiguity and confusion – Precision • Truthful results • Distortion‐free presentation – Efficiency • Minimal “chartjunk”
14
ChartJunk Wikipedia - Chartjunk refers to all visual elements in charts and graphs that are not necessary to comprehend the information represented on the graph, or that distract the viewer from this information What is the Chart Junk in this figure?
15
ChartJunk An example of a chart containing gratuitous chartjunk. This chart uses a large area and a lot of "ink" (many symbols and lines) to show only five hard-to-read numbers, 1, 2, 4, 8, and 16. Tufte: The interior decoration of graphics generates a lot of ink that does not tell the viewer anything new. The purpose of decoration varies — to make the graphic appear more scientific and precise, to enliven the display, to give the designer an opportunity to exercise artistic skills. Regardless of its cause, it is all non-data-ink or redundant data-ink, and it is often chartjunk.
16
Figure Captions Figure Captions are an ESSENTIAL part of Journal Quality Figures which can give clarity, precision, and efficiency to figures How to phrase good figure captions? – Describe “(Vertical axis quantity) vs. (Horizontal axis quantity)” for Experiment – Include all important experimental details – Identify multiple curves or traces – Match the graphic Let’s look at some examples….
17
Figure Captions Describe what is graphed
“(Vertical axis quantity) vs. (horizontal axis quantity) for (experiment)” An aside: What is the meaning of the data points versus lines connecting data points in this figure?
18
Figure Caption – Include essential Experimental Details
How would the quality of this plot change if it were produced in black and white? What would you change?
19
Figure Caption Caption should match the graphic
Different symbols in graph and caption
20
Figure should have Good Readability
Includes various aspects of Clarity, Precision, and Efficiency Good resolution – Dots per inch of image. Look at specifications for journal (eg. our example with Applied Physics Letters) Clear, concise, complete Font is legible (size, boldness, font choice) Colors enhance the graphic not detract Are graphics still clear when figure is reduced to final print size? All parts of figure are identified or explained Figure are proofed carefully
21
A good plot
22
I do not necessarily agree with this… It is OK to say ‘Dashed Line’ or ‘Solid Line’, but be careful with color… may figures are printed in journal as GRAYSCALE
23
What is WRONG with this plot?
29
What is deficient in this figure?
30
Use of COLOR can improve readability
What else can be improved in figure on left?
31
Data Acquired from Instruments NEED to be Replotted
Do NOT save the ‘screen shot’ from an instrument…. Instead, save the DATA itself either in a TEXT file or EXCEL file Replot the data, adjust fonts, colors, scales as needed.
32
Class Exercise: Write a Simple Matlab program
Use Matlab HELP or DOCUMENATION SEARCH as needed Create a MATLAB program which Reads in the TIME, VOLTAGE, and CURRENT sample data which we used in lecture. Create a plot of VOLTAGE versus TIME. Make sure that your plot has proper labels! Create a plot of POWER=VOLTAGE*CURRENT versus TIME. Make sure that your plot has the proper labels! If you have time, edit one of your plots to make it PUBLICATION quality. Pay attention to font size, color, labels, etc.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.