prob1 HW2

# prob1 HW2 - backwards by ones to 2 Store your answer in a...

This preview shows page 1. Sign up to view the full content.

% Areeje Khalek % 8/23/2009 3:25 PM % Prob1 of hw02 % Script Name: prob1 % Script Variables: % 1. evens (double) - a vector of even numbers between 4 and 32 % 2. reverse (double) - a vector of numbers going backwards from 21 to 2 % 3. theta (double) - a vector of 80 evenly spaced numbers from 0 to 2*pi % 4. myZeros (double) - a vector of 25 zeros % 5. random (double) - a vector of 10 random numbers between 3 and 8 % % Problem Statement: % Using the given "prob1" script, create the following vectors. Note, % all vectors should be row vectors, *NOT* column vectors. Also, do % not use the direct entry method to construct the vectors. % % (a) Construct a vector containing all of the even numbers between 4 and % 32, inclusive of the endpoints. Store your answer in a variable % called "evens". Use the range specification/colon operator method. % % (b) Construct a vector containing numbers starting at 21 and counting
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: % backwards by ones to 2. Store your answer in a variable called % "reverse". Use the range specification/colon operator method. % % (c) Construct a vector containing 80 evenly spaced values between 0 % and 2*pi. Store your answer in a variable called "theta". Use the % linspace method, not the range specification/colon operator method. % % (d) Construct a vector containing 25 elements all of which are zeros. % Store your answer in a variable called "myZeros". Use the built-in % zeros() function. % % (e) Construct a vector containing 10 randomly generated numbers between % 3 and 8. Store your answer in a variable called "random". Use the % built-in rand() function. % evens = 4:2:32; e reverse = 21:-1:2; r theta = linspace(0, 2.*pi, 80); t myZeros = zeros(1, 25); m random = rand(1, 10).*5 + 3;...
View Full Document

## This note was uploaded on 10/22/2009 for the course CS 1371 taught by Professor Stallworth during the Fall '08 term at Georgia Tech.

Ask a homework question - tutors are online