Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to MATLAB Section2, statistics course Third year biomedical dept. Dina El Kholy, Ahmed Dalal.

Similar presentations


Presentation on theme: "Introduction to MATLAB Section2, statistics course Third year biomedical dept. Dina El Kholy, Ahmed Dalal."— Presentation transcript:

1 Introduction to MATLAB Section2, statistics course Third year biomedical dept. Dina El Kholy, Ahmed Dalal

2 Contents Error messaged appearing at the console M-files Stem Subplot,stem,subplot Basic statistical functions Functions Find Loading mat files Fprintf, input ECG data file and draw it: assignment!!

3 M-files Text files containing MATLAB code. Useful for complex tasks. we can store the typed input into a file and tell MATLAB to get its input from that file. Extension:.m

4 M-files If an m-file contains MATLAB statements just as you would type them into MATLAB, they are called scripts. M-files can also accept input and produce output, in which case they are called functions. The MATLAB executes the instructions, just as if you had typed them in the command window.

5 M-files scripts : simple examples Create an m-file(using the MATLAB text editor) Type t he following statement in it Save it by the name example1.m Run the script by typing the filename example1 in the command window Note that when execution completes, the variables (A, b, and x) remain in the workspace. Type whos to make sure!

6 M-files scripts: PLOT EXAMPLE

7

8 M-files scripts: subplot example

9 M-files functions functions are programs (or routines) that accept input arguments and return output arguments Each M-file function has its own area of workspace, separated from the MATLAB base workspace

10 Anatomy of the function Try out this simple example:(write it in an m-file

11 Scripts vs. Functions

12 Inputs and outputs from functions

13 Input to scripts The variable is defined in the script file. The variable is defined in the command prompt meaning that it exists in the workspace before you run the script. The variable is entered when the script is executed using the built-in input function.(Check it out)

14 Data Analysis functions

15 Assignments Read & understand the help to the functions in the data analysis functions slide and summarize what you understand about each function in a report. Try to use this function in the MATLAB to make sure you understand them(you are supposed to hand in this report) Learn what are the.mat files : ▫Load the file(ECG.mat) into MATLAB and plot the signal


Download ppt "Introduction to MATLAB Section2, statistics course Third year biomedical dept. Dina El Kholy, Ahmed Dalal."

Similar presentations


Ads by Google