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

1. Write an M-file script that contains all the commands you learned in the prev

ID: 3195815 • Letter: 1

Question

1. Write an M-file script that contains all the commands you learned in the previous labs (create one script for one lab). B expressions, in an M-file script, that will plot the functions In -) 2. Write the MATLAB in and irsin(2Use an appropriate domain for z. 3. Write a MATLAB function that converts the Celsius degree to Kelvin degree. 4. Write a MATLAB expressions, in an M-fle script, that will create a vector u with the elements (a) 2, 4, 6, 8, ..1000. (b) 10, 8, 6, 4, 2, 0,-2,-4,-6. (c) the even numbers between 21 and 95. (d) Zn = 1-_, only the first 100 elements. 5. Use a single MATLAB expression to find the total number of elements in the vector created out of all multiples of 5 that fall between 11 and 12345 6. Create two column vectors 21 and y=13 9 and Write a MATLAB expressions in an M-file script that will execute the following opera- tions on the vectors z and y (a) Add the sum of the elements in to y. (b) Divide each element of y by the corresponding element in z. (c) Raise each element of z to the power specified by the corresponding element in y (d) Multiply each element in z by the corresponding element in y, calling the result z (e) Add up the elements in z and assign the result to a variable called w.

Explanation / Answer

Answer 2]

x=[1.5:0.5:20]; %you can change the domain according to your needs

y=log(x.^2-x);

plot(x,y); %save and run

x = [0:0.01:10];   %you can change the domain according to your needs, for more precisoin use increment values less than 0.01

y= abs(x.*sin(2*x));

plot(x,y) %save and run

Answer 3]

function convert=cnvrt(cel);

convert=273.15+cel;

%now you need to call the function

kelvin = cnvrt(15)

Answer 4]

(a) i = 2 : 2 : 1000;

disp(i);

(b) i = 10 : -2 : -6:

disp(i);

(c) i = 22 : 2 : 94;

disp(i);