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

Generate a random vector with 20 elements, call the vector vec. Display vec. Fin

ID: 3580776 • Letter: G

Question

Generate a random vector with 20 elements, call the vector vec. Display vec. Find the sum of all the elements (called sumval), the mean (called meanval), and the standard deviation (called stdval). Display all results. Generate a vector with values from 0 to 2 pi and a step size of 0.1. Find the tangent of each entry in the vector and plot it. Make the title your name and label your x and y axis appropriately. Write a loop to generate a random integer between 1 and 10 and check if it's an even number. If the number is even, keep going, once the number has been odd three times, break the loop and display the three odd numbers. Given the system of linear equations below, find and display i_A: [40 -10 -10 190 10 0 -210 0 20] [i_A i_B i_C] = [0 10 0] Generate a 5 times 5 matrix with all zero entries called matx. Place the number 5 at locations (2, 2), (1, 5), and (4, 3). Display matx. Transpose matx and display the resulting matrix called matxt. Create the matrix and vector given below. A = [2 9 2 4 3 1 7 1 6] and b = [5 2 3] Find c and display the results for the following: A middot b = c b^T middot A = c

Explanation / Answer

1)

v = zeros(20,1);
sum=0;
count=20;
for i=1:20
tmp = randi([1,20]);
v(i,1)=tmp;
sum=sum+tmp;
end
mean = sum/20;
std=0;
for i=1:20
std = std + (v(i,1)-mean)*(v(i,1)-mean);
end
std = sqrt(std/20)
disp(sum);
disp(mean);
disp(std);

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote