Math3650Lab1

7
Lab 1 Chris Schifer Nick Spivey Matthew Mauhar Carl Fitzpatrick 1. Create a vector of the even whole numbers between 29 and 73 % Start by clearing the workspace and command window clear clc % Create the matrix containing all the numbers between the two inputted numbers X = [29:73]; % Create index and empty set to allow the for loop to run through all of the numbers i = 1; Y = []; for j = 1:1:length(X) if round(X(j)/2)-( X(j)/2)== 0 % F ilters out the odd numbers Y(i) = X(j); % Creates the matrix with the correct values i = i +1; % Updates indices end end disp(Y); % Displays the matrix containing only the even numbers Output: 2. %creates a horizontal vector of whole numbers counting by 3's from 2 to 32 %and then transposes itself into a column vector a2=[2:(32-2)/10:32]'

Transcript of Math3650Lab1

7/23/2019 Math3650Lab1

http://slidepdf.com/reader/full/math3650lab1 1/7

7/23/2019 Math3650Lab1

http://slidepdf.com/reader/full/math3650lab1 2/7

7/23/2019 Math3650Lab1

http://slidepdf.com/reader/full/math3650lab1 3/7

7/23/2019 Math3650Lab1

http://slidepdf.com/reader/full/math3650lab1 4/7

7/23/2019 Math3650Lab1

http://slidepdf.com/reader/full/math3650lab1 5/7

7/23/2019 Math3650Lab1

http://slidepdf.com/reader/full/math3650lab1 6/7

7/23/2019 Math3650Lab1

http://slidepdf.com/reader/full/math3650lab1 7/7