Computing for Engineers
Computing for Engineers ENGR 1731
Popular in Course
Mr. Durward Gleason
verified elite notetaker
Popular in General Engineering
verified elite notetaker
This 8 page Class Notes was uploaded by Mrs. Alaina Hermiston on Monday October 12, 2015. The Class Notes belongs to ENGR 1731 at Georgia Southern University taught by Maria Alba-Flores in Fall. Since its upload, it has received 17 views. For similar materials see /class/222069/engr-1731-georgia-southern-university in General Engineering at Georgia Southern University.
Reviews for Computing for Engineers
Report this Material
What is Karma?
Karma is the currency of StudySoup.
You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!
Date Created: 10/12/15
ENGR 1731 bomputlng 10139 unglneers Mechanical and Electrical Engineering Technology Lecture 7 Vectors in Matlab Examples Prof AlbaFlores Vectors in Matlab Examples What the following Matlab statements do 1 x linspace314010 2 X37 Y copies the third through seventh elements of x into the rst through fourth elements or y It y did not already exist it is created by the assignment 3 y3 What the following Matlab statements do 3 z linspace2l255 4 2 7 5 z7 9 21 22 23 24 25 x onesl5 creo res 0 row vector of length 5 filled with ones 7 y zeros5l creo res 0 column veo ror of length 5 filled with zeros Other example Consider the following arrays A and B A 550 600 590 400 600 B 530 600 610 500 600 Write a Matlab program that will calculate The number of elements in array A that are greater or equal to the elements in array B Call the result R1 How many times the elements in array A are greater that 550 Call the result R2 Working with vectors Example Program vectorsexlm o0 o0 This program compares the vectors A and B and computes the tollowing 1 Calculate the number of elements in A that are greater or equal to the elements in B Call the result R1 2 How many times the elements in array A are greater than 550Call the result R2 o0 o0 o0 o0 o0 oc 00 Clear Definition of the two arrays A 550 600 590 400 600 B 530 600 610 500 600 SOLUTION TO QUESTION 1 xl is an array that contains the elements of A that are greater or equal to the elements in B o0 o0 xlAAgtB answ Xl 550 600 600 yl is a 1x2 array that will give the number of rows and the number of columns of array xl ylsizexl answ yl l j R1 is a scalar that will give the number of columns of array yl Rlyl2 answ Rl 3 display39Number of elements in A that are gt or to elements in B39 R1
Are you sure you want to buy this material for
You're already Subscribed!
Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'