1 / 14

Introduction to Matlab

Introduction to Matlab. EE 2303 Lab. to. Matlab. Welcome. MATLAB stands for “Mat rix Lab oratory” APPLICATIONS OF MATLAB: Mathematical Calculations Data Analysis & Visualization Software Development Simulation. Getting Started. Workspace & Directory. Command-Window.

dareh
Download Presentation

Introduction to Matlab

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to Matlab EE 2303 Lab

  2. to Matlab Welcome MATLAB stands for “Matrix Laboratory” APPLICATIONS OF MATLAB: • Mathematical Calculations • Data Analysis & Visualization • Software Development • Simulation

  3. Getting Started Workspace & Directory Command-Window Command- History

  4. How to Open Matlab Editor???? FILE NEW M-FILE

  5. Basic Matlab Commands • clear all: clears workspace of all variables • close all : closes all the figure windows • plot (x,y) : plots vector “y” versus “x” • % : used for Comments • help : when used with command gives its syntax

  6. “help” Command

  7. Basic Arithmetic Operators + : Arithmetic addition - : Arithmetic subtraction * : Arithmetic multiplication / : Arithmetic division ^ : Exponent or power .* : (element by element for arrays)

  8. Built-in Waveform Functions • cos (): Generates a cosine wave • sin() : Generates a sine wave • square(): Generates a square wave • square( ,duty): Generates a square with specified duty cycle • sawtooth(): Generates a sawtooth wave • sawtooth(t,0.5): Generates a triangle wave

  9. Sine-wave Generation clear all; close all; frequency=1000; timeperiod=1/frequency; amplitude=1; dcoffset=0; t=0:0.00001:2*timeperiod; out=dcoffset+amplitude*cos(2*pi*frequency*t); plot(t,out);

  10. Sine-wave Generation • clear all; • close all; • frequency=1000; • timeperiod=1/frequency; • amplitude=1; • dcoffset=0; • t=0:0.00001:2*timeperiod; • out=dcoffset+amplitude*cos(2*pi*frequency*t); • plot(t,out);

  11. How to Execute the code??? Select all Right ClickEvaluate Selection Debug RUN Press F5 Type File name in Command window and press “Enter”

  12. Simulated Wave forms

  13. Square wave Generation clear all; close all; frequency=1000; timeperiod=1/frequency; amplitude=1; dcoffset=0; t=0:0.00001:2*timeperiod; out=dcoffset+amplitude*square(2*pi*frequency*t); plot(t,out);

  14. More Commands xlabel(‘ ’) : Allows you to label x-axis ylabel(‘ ‘) : Allows you to label y-axis title(‘ ‘) : Allows you to give title for plot subplot() : Allows you to create multiple plots in the same window

More Related