Question: Hello, I am using the MatLab software for this problem. If you could try and explain what you're doing as well that would be great,
Hello, I am using the MatLab software for this problem. If you could try and explain what you're doing as well that would be great, thanks in advance!

2. Using array operations (no loops), create and find the areas of 100 random triangles as follows: Create a random array P that is 3x2x100 using rand. We interpret PC:,.,.) as the (x,y) vertices of the ith triangle, which you can think of as. X1y: X2 y2 X3 93 Calculate, using array operations, a 100x3 array L that contains the lengths of the three sides of each triangle. (Hint: What does P(2,1,:)-P(1,1,:) represent? What does P(2,2,:)-P(2,1,:) represent? Use the distance formula to then find the values in L(:,1), the lengths of the sides connecting (X1,Y) to (X2,y2). Then similarly find the entries in L(:,2) and finally L(:,3) Finally, calculate the area of each triangle using Herron's formula: A = /s(-a)(s - b)(s -c) where s is the semiperimeter s = 4++and create a 100x1 array A that contains these areas. 2 2. Using array operations (no loops), create and find the areas of 100 random triangles as follows: Create a random array P that is 3x2x100 using rand. We interpret PC:,.,.) as the (x,y) vertices of the ith triangle, which you can think of as. X1y: X2 y2 X3 93 Calculate, using array operations, a 100x3 array L that contains the lengths of the three sides of each triangle. (Hint: What does P(2,1,:)-P(1,1,:) represent? What does P(2,2,:)-P(2,1,:) represent? Use the distance formula to then find the values in L(:,1), the lengths of the sides connecting (X1,Y) to (X2,y2). Then similarly find the entries in L(:,2) and finally L(:,3) Finally, calculate the area of each triangle using Herron's formula: A = /s(-a)(s - b)(s -c) where s is the semiperimeter s = 4++and create a 100x1 array A that contains these areas. 2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
