Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Matlab: Vectors and Arrays Examples - Georgia Southern University ENGR 1731 - Prof. Maria , Study notes of Engineering

Examples of using vectors and arrays in matlab, including copying elements, creating vectors of ones and zeros, and comparing arrays. It also includes a matlab program to calculate the number of elements in array a that are greater than or equal to the elements in array b and the number of elements in array a that are greater than 550.

Typology: Study notes

Pre 2010

Uploaded on 10/01/2009

koofers-user-mpa-1
koofers-user-mpa-1 🇺🇸

5

(1)

10 documents

1 / 9

Toggle sidebar

Related documents


Partial preview of the text

Download Matlab: Vectors and Arrays Examples - Georgia Southern University ENGR 1731 - Prof. Maria and more Study notes Engineering in PDF only on Docsity! ENGR 1731 C ti f E i Georgia Southern University ompu ng or ng neers Mechanical and Electrical Engineering Technology Spring 2009 Lecture #7 ‐ Vectors in Matlab: Examples  Prof.  Alba‐Flores Vectors in Matlab: Examples        6.- (1 5)x = ones , creates a row vector of length 5, filled with ones 7.- y = zeros(5,1) creates a column vector 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 vectors_ex1.m % This program compares the vectors A and B, and % t th f ll i compu es e o ow ng: % 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 550.Call the result R2 Clear % Definition of the two arrays A = [ 550 600 590 400 600]; B = [ 530 600 610 500 600];
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved