SlideServe
Menu
Préférences
© SlideServe · v2026

Introduction to Programming in MATLAB

bedros avatar
11 diapositives · 289 Views · Aug 04, 2014

Introduction to Programming in MATLAB. Intro. MATLAB Peer Instruction Lecture Slides by  Dr. Cynthia Lee, UCSD  is licensed under a  Creative Commons Attribution- NonCommercial - ShareAlike 3.0 Unported License . Based on a work at  www.peerinstruction4cs.org . Relational Operators.

Introduction to Programming in MATLAB - slide 1
01 / 11Introduction to Programming in MATLAB
1 / 17

Télécharger la présentation

Introduction to Programming in MATLAB
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. Introduction to Programming in MATLAB Intro. MATLAB Peer Instruction Lecture Slides by Dr. Cynthia Lee, UCSD is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.Based on a work at www.peerinstruction4cs.org.

  2. Relational Operators

  3. Relational Operators • 4 < 5 true (1) • 4 <= 5 true (1) • 4 == 5 false (0) • 4 ~= 5 • 4 > 5 false (0) • 4 >= 4 • ‘A’ < ‘B’ (a) true (1) (b) false (0) (c) other/error (a) true (1) (b) false (0) (c) other/error (a) true (1) (b) false (0) (c) other/error

  4. Why would we want to test “<“ between a number and a matrix? >> im = imread(‘rainbow.jpg’); >> g = im(:,:,2); >> result = g > 200; • What type of variable will result be after the assignment? What does this code do, conceptually? • Increases the amount of green in the image • Identifies pixels with high green value • Removes green layer from the image • None/more than one/MATLAB error

  5. A new data type for variables!

  6. LOGICAL Operators

  7. Why would we want to test “<“ between a number and a matrix? >> im = imread(‘rainbow.jpg’); >> result = im(:,:,1) > 200 & im(:,:,2) > 200 & im(:,:,3) > 200; • First, take each part by itself and figure out what it does; then combine the parts. What does this code do, conceptually? • Identifies pixels that have high red, or high blue, or high green value(s) • Identifies pixels that are close to black • Identifies pixels that are close to white • Error

  8. Can you write code for the other answer choices? >> im = imread(‘rainbow.jpg’); >> result = im(:,:,1) > 200 & im(:,:,2) > 200 & im(:,:,3) > 200; • Identifies pixels that have high red, or high blue, or high green value(s) • Identifies pixels that are close to black

  9. “Green screen” special effects • Actors or other objects are filmed in front of a screen with a very specific shade of green • Later, a computer program checks the color of each pixel of the movie • Pixels matching that specific shade of green are replaced with pixels from another image/movie • Pixels not matching that specific shade of green are left alone

  10. “Green screen” special effects • Actors can wear green and be invisible in the final movie • The two men on the left are moving a puppet • The man on the right, if he doesn’t put his green shirt back on, will appear to be a floating torso