Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please help with both Problems in MATLAB. Problem 3: Area of a quadrilateral. A

ID: 3716544 • Letter: P

Question

Please help with both Problems in MATLAB.

Problem 3: Area of a quadrilateral. A quadrilateral is a 2-dimensional figure with 4 sides that may or may not be parallel You will use 2 different methods to determine the area of a quadrilateral. Create two vectors using the data given below (note the last value of each array is the same as the first to allow the figure to close if you were to plot the quadrilateral). 1.8000 2.7000 3.2000 -0.5000 -1.8000 2.0000 1.5000 2.0000 3.7500 2.0000 For the first method of calculating the area of the quadrilateral you should use the formula Area- (note that this problem does not use the fifth element of each array). Do not create separate variables forxl, yl, x2, y2 etc. but use the specified elements of each array you created earlier For the second method, you will use Hero's formula for finding the area of a triangle where a, Areas(s -a)(s- b)(s- c) b, and c are the sides of a triangle and s is the semiperimeter (one half of the perimeter) of the triangle. The plot below (Figure 1) shows a green line that connects the first point and the third point dividing your quadrilateral into two triangles. Figure 1 CMPSC 201 - Spring 2018 Project 5 Using the formula to determine the distance between two points and Hero's formula find the area of each triangle then add the two areas together.

Explanation / Answer

Problem3

================

%%problem 3
x=[-1.8 2.7 3.2 -0.5 -1.8];
y=[-2 -1.5 2 3.75 -2];
%first method
t1=x(1)*y(2)-x(2)*y(1);
t2=x(2)*y(3)-x(3)*y(2);
t3=x(3)*y(4)-x(4)*y(3);
t4=x(4)*y(1)-x(1)*y(4);
A=(t1+t2+t3+t4)/2 % area of quad

%second method
a=sqrt((x(1)-x(2))^2+(y(1)-y(2))^2); % length of each side
b=sqrt((x(2)-x(3))^2+(y(2)-y(3))^2);
c=sqrt((x(3)-x(4))^2+(y(3)-y(4))^2);
d=sqrt((x(4)-x(1))^2+(y(4)-y(1))^2);
diag=sqrt((x(4)-x(2))^2+(y(4)-y(2))^2);
s=(a+b+diag)/2;
A1=sqrt(s*(s-a)*(s-b)*(s-diag)); % area of first triangle
s=(c+d+diag)/2;
A2=sqrt(s*(s-c)*(s-d)*(s-diag)); % area of second triangle
A=A1+A2 % area of quad

======================

Problem4

===================

m=load('studentgrades','-mat') % loading the mat file
gradesr=m.ans;
avg_score=sum(gradesr,1)/25 % average score for each assesment
std_total=sum(gradesr,2) % total marks for each student

A=length(find(std_total>=460)) % grade assignment
Am=length(find(std_total<460 & std_total>=450))
Bp=length(find(std_total<450 & std_total>=440))
B=length(find(std_total<440 & std_total>=410))
Bm=length(find(std_total<410 & std_total>=400))
Cp=length(find(std_total<400 & std_total>=390))
C=length(find(std_total<390 & std_total>=350))
D=length(find(std_total<350 & std_total>=300))
F=length(find(std_total<300))

=======================

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote