c2a_activity1

c2a_activity1 - %ADDS THE SCALAR TO EACH ELEMENT...

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

View Full Document Right Arrow Icon
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % PROGRAMMER(S) AND PURDUE EMAIL ADDRESS(ES): % 1. HEIDI DIEFES-DUX HDIEFES@PURDUE.EDU % % SECTION: 203 % % ASSIGNMENT #: CLASS 2A, ACTIVITY 1 % % ACADEMIC INTEGRITY STATEMENT: % % I/WE HAVE NOT USED SOURCE CODE OBTAINED FROM % ANY OTHER UNAUTHORIZED SOURCE, EITHER MODIFIED % OR UNMODIFIED. NEITHER HAVE I/WE PROVIDED ACCESS % TO MY/OUR CODE TO ANOTHER. THE PROJECT I/WE AM/ARE SUBMITTING % IS MY/OUR OWN ORIGINAL WORK. % % PROGRAM DESCRIPTION: VECTOR OPERATORS. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % --- INPUTS --- % ASCALAR=3; AROWVECTOR=[0 1 2 3]; BROWVECTOR=[-2,-1,1,2]; CROWVECTOR=[-5,1,3]; ACOLVECTOR=[0;1;2;3]; BCOLVECTOR=[-5;-2;1;4]; B % --- CALCULATIONS --- MO1=AROWVECTOR+AROWVECTOR %ADD CORRESPONDING ELEMENTS TOGETHER MO2=AROWVECTOR+BROWVECTOR %ADD CORRESPONDING ELEMENTS TOGETHER MO3=AROWVECTOR+ASCALAR
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: %ADDS THE SCALAR TO EACH ELEMENT MO4=AROWVECTOR-AROWVECTOR %SUBTRACT CORRESPONDING ELEMENTS %MO5=AROWVECTOR-CROWVECTOR %ERROR, LENGTH OF VECTORS MUST AGREE MO6=ACOLVECTOR+BCOLVECTOR %ADD CORRESPONDING ELEMENTS TOGETHER % MO7=AROWVECTOR+BCOLVECTOR %ERROR, CAN'T ADD A ROW AND A COLUMN % % MO8=AROWVECTOR*BROWVECTOR %ERROR, CAN'T MULTIPLY 2 ROWS TOGETHER USING MATRIX MULTIPLICATION MO9=AROWVECTOR.*BROWVECTOR %MULTIPLIES CORRESPONDING ELEMENTS TOGETHER MO10=AROWVECTOR*ASCALAR %MULTIPLIES EACH ELEMENT BY THE SCALER MO11=AROWVECTOR.*ASCALAR %MULTIPLIES EACH ELEMENT BY THE SCALER MO12=AROWVECTOR./BROWVECTOR %DIVIDES EACH ELEMENT OF A BY THE CORRESPONDING ELEMENT IN B % MO13=AROWVECTOR^ASCALAR %ERROR, THE MAXTRIX MUST BE SQUARE TO PERFORM THIS OPERATION MO14=AROWVECTOR.^ASCALAR %RAISES EACH ELEMENT TO THE SCALAR POWER M % --- OUTPUTS ----%...
View Full Document

Ask a homework question - tutors are online