Need help It a variable has the dimensions 5 x 1, could it be considered to be (
ID: 2267343 • Letter: N
Question
Need help
It a variable has the dimensions 5 x 1, could it be considered to be (select all that apply): a,matrix b. a row vector c. a column vector d. a scalar S. If a variable has the dimensions 1 x 1, could it be considered to be (select all that apply): a. a matrix b, a row vector c. a column vector d. a scalar 6. Provide the commands and the results obtained for each of the following operations: Given C157 3 0 2 9 25 14 0 21 08 -9 11 18 0 5 01, provide the MATLAB commands to execute the following operations: a. Delete the zeros (0) from the vector c (you could use the find function) b. Set the negative values cf C to 1 c. Extract the values of c greater than 3 in a vector D. d. Add 3 to the values of C that are even (use mod (C,2)) e. Compute the average (mean), the standard deviation (std), and the variance (var) of the values of c. f. Compute the product (prod) of the non-zero elements of c. g. Obtain the maximum (max) and minimum (min) value of C Hint: mean, var, prod, etc. are the names of the functions to use N M Ctr AltExplanation / Answer
4.A variable having 5x1 dimensions is splitted into a 5x1 matrix and a matrix having a row of 5 elements and one row
so the answer is a and b.
5.A variable having 1x1 dimensions is splitted into a 1x1 matrix and a matrix having a row of 1 elements and one row and also one column....as the variable having one dimension it can be considerd as a scalar also...So the answer is all 4 options i.e a,b,c,d...
6.(a) c=(c==0)=[]; it will delete the zeros
alternatively this command is also used
c(find(c==0))=[];
(b)c(c<0)=1;
(c)D=find(abs(c)>3);
(d) Firstly to find the even number in a vector:
even number=c(mod(c,2)==0);
finally adding 3 to even number as follows:
D=sum(even number,3);
(e). Average=mean(c);
std deviation=std(c);
vaiance=var(c);
(f)c=c(c~=0);
prod(c);
(e)maximum number is obtained by max(c);
minimum number is obtained by min(c);
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.