DeGracia_Miguel_19481379_sec22_lab4

# DeGracia_Miguel_19481379_sec22_lab4 - Miguel De Gracia...

This preview shows pages 1–2. Sign up to view the full content.

%% Miguel De Gracia. 19481379. Lab Assignment 4. Section 22 % %% Problem 1a % a=5; b=16; my_adder(3,4); %MATLAB assigned values to a and b, but when given the function command it %only used the input variable and displayed the answer of the function. c=my_adder(a,b); %In this case MATLAB remembers the variables that were assigned to a and b %earlier and uses them in function my_adder. my_adder([5 6],[1 2]); %It adds element by element. The first indices by the first indeces of the %following row vector and the second by the second returning as the answer, %[6 8]. % %in1+in2; %MATLAB will return an error saying that the variables in1 and in2 have not %been defined because these are local variables that exist inside the %function and not in the command window. % %c-out; %MATLAB will return an error stating that out is an undefined variable %because it only exists in the function. type my_adder t %% Problem 1b % ht=[1 2 3]; b=[2 5 8]; areas=tri_area(b,ht) type tri_area t %% Problem 1c % G=my_numbers(3,2,7)

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 02/18/2010 for the course ENGINEERIN 7 taught by Professor Patzek during the Spring '08 term at Berkeley.

### Page1 / 3

DeGracia_Miguel_19481379_sec22_lab4 - Miguel De Gracia...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online