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

QUESTIONs Write a single MATLAB command to compute the following vector and stor

ID: 3283030 • Letter: Q

Question

QUESTIONs Write a single MATLAB command to compute the following vector and store it in a variable named v. You should use vector operations such as. and / and so on 32 43 61 3'45 60 62 Now write a single MATLAB command that computes the number of terms of v that are greater than 10 Hint 1:The command vc10 produces a vector containing 1's and O's according to whether the corresponding entry of v satisfies the given inequality ( In which case the output entry is 1) or not (in which case the output entry is o) A similar command will help you here Hint 2: The command sum) will take the sum of the entries of a vector

Explanation / Answer

Solution of both the questions are given in single matlab code which is given below

Note:

for question no.1: data is two large so it is not easy to use 'disp' or 'fprintf' function so to see the result of v, v_div, v_sum etc click on the 'Workspace' area of matlab and you get the data in excel sheet.

for question no.2: Direct run the matlab code given below and you get the result

MatLab code with comment:

file name in txt form: compute_and_store_vector.m

%%----total number of terms are 60---------%%
%%--so the size of varibale v should be 1x60 matrix--------%%
v=zeros(1,60);%first defining variable

%%----compute vectors and store in variable v------------%%
for k=1:1:60
%store given values in matrix v having one row and 60 column
v(k)=((k+1).^k)./(k+2);
end
%%------using vector operation .* by variable v itself----%%
v_multi=v.*v;%you can also use other vector in place of v or some number
%%------using vector operation ./ by variable v itself----%%
v_div=v./v;%you can also use other vector in place of v or some number
%%------using vector operation + by variable v itself----%%
v_sum=v+v;%you can also use other vector in place of v or some number
%%------using vector operation - by variable v itself----%%
v_minus=v-v;%you can also use other vector in place of v or some number


%%------compute number of terms of v that are greater than 10^9----%%
count_num=0;
for k=1:1:60
if(v(k)>1e9)%check for every entries which are greater than 10^9
count_num=count_num+1;%count the number of terms greater than 10^9
end
end
%%-----------Display Result--------------%%
%%----for question number 1------------%%
%%---data is two large so it is not easy to use 'disp' or 'fprintf'
%%function
%%so to see the result of v, v_div, v_sum etc click on the 'Workspace' area
%%and see the data in excel sheet

%%--------for question number 2----------%%
disp(count_num)%%number of terms greater than 10^9

Output:

>> compute_and_store_vector
51