You are on page 1of 2

MARY JOANNE C.

ANINON
MSCE Student

 WEEK 2 MATLAB CALCULATION

Principal=1000;
Rate=0.1;
Time=2;
debt=(Principal*(1+Rate)^Time)

 WEEK 2 LESSON 1 WRAP UP

dist_km=100/1000;
time_hr=9.58/(60*60);
hundred=dist_km/time_hr
dist_kip=42.195;
time_kip=2+(1/60)+(39/(60*60));
marathon=dist_kip/time_kip

 WEEK 3 COLON OPERATOR

odds=1:2:100
evens=100:-2:2

 WEEK 3 MATRIX INDEXING

A = [1:5; 6:10; 11:15; 16:20];


v=A(:,2)
A(end,1:5)=0

 WEEK 3 MATRIX ARITHMETIC

A = [1:5; 6:10; 11:15; 16:20];


x = [1 1 1 1]
y = [1 1 1 1 1]
y=y'
result=(x*A)*y

 WEEK 4 A SIMPLE FUNCTION

function x=tri_area(b,h)
x=0.5*b*h;
end
 WEEK 4 CORNER CASE

function [top_left, top_right, bottom_left, bottom_right]=corners(A)


Acorners=A([1,end],[1,end]);
top_left=Acorners(1,1);
top_right=Acorners(1,2);
bottom_left=Acorners(2,1);
bottom_right=Acorners(2,2);
end

 WEEK 4 TAXI FARE

function fare=taxi_fare(d,t)
add_dist=ceil(d-1);
add_time=ceil(t);
fare=5+add_dist*2+add_time*0.25;
end

You might also like