Please answer the following matlab questions :
3) (14 Points Total) Short Answer A: (2 Poin) What are loops used for? What is the difference between for and while loops? loops uset to run achm mure than on has…….kn w… number perk (1 Point) Write the number 0.0035 using exponential notation c) (2 Points) Ask the user to enter their name and store it in a variable d) (3 Points) Using the variable from c) above, when the name entered is Davison, say welcome professor. otherwise tell the user whether or not the name they entered starts with the letter ‘D’. ent en You are given a matrix m Write code that will determine the result of (4 Points) summing up all the values in the matrix. (2 Points) Generate a random number from 1.5 to 3.5 and store it in a variable. rane CE1.5
Expert Answer
b) 3.5*10^-3
c) x=input(‘Enter your name’);
d)
x=input(‘Enter your namen’);
if(strcmp(‘Davison’,x)==1)
fprintf(‘welcome professor’);
else
if(strcmp(‘D’,x(1))==1 || strcmp(‘d’,x(1))==1)
fprintf(‘Name entered starts with D’);
else
fprintf(‘Name entered not starts with D’);
end
end
e)
sum=0;
for i = 1:numel(m) %use linear indexing to iterate through all the elements in array
sum = sum+m(i);
end
f)
x=randi([1.5, 3.5]);