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

Need to do the following using MATLAB. 1. Write a script m-file, which asks from

ID: 3860389 • Letter: N

Question

Need to do the following using MATLAB.

1. Write a script m-file, which asks from a client the name, the current status at the university, and the year when client will graduate. Use fprintf function to create the following text:

My name is Firstname Lastname.

I am a student of University name.

I am a Standing.

My major is Major.

I will graduate after number of years year(s).

I am looking for a job in Job.

Words and digits indicated by bold letters should be variables .

2. Write function m-files and use them to solve the following problems:

a) to evaluate the volume of the cylinder with input parameters (the radius of the base and the height) as arguments. If at least one of these input parameters is negative an error message should appear.

an error message should appear if function is undefined for some values of variables.

c) to create a function y = ( x 2 ? 1 if x < 0, 3x ? 1 if x > 0.)

d) to plot the function created in 2c in interval [?2, 2].

3) Write a function m-file to create a vector in a dialog mode. Use the size of the vector as an argument, and the created vector as an output. Use for ... end loop and input function.

4) Write a function m-file to create a matrix in a dialog mode. Use the size of the matrix as an argument, and the created matrix as an output. Use for ... end loop and input function.

5) Write a function m-file to evaluate the product of the components of the given vector. Use for ... end loop.

6) Write a function m-file to evaluate the number of classes taken by a student. The program should ask a student his name, how many terms he took, and how many classes he/she took each term. Then, the program should calculate the total number of classes taken by the student and print: Student name has taken number of classes classes.

7. Write a function m-file to plot in the same figure graphs of the functions sin(x), cos(x), 2sin(0.5x), and ? cos(2x) in the interval [??, ?], choose different colors and different lines for different functions.

8. Write a function m-file to create a matrix of plots in a single figure window for graphs of the functions x, x 2 , x 3 , and x 4 in the interval [?2, 2]. Use different types of lines.

In(ar + Y – 2 + 25) VTY – a

Explanation / Answer

1.

Firstname = input('What is your first name? :','s');
% 's' indicates that name is a string.
Lastname=input('What is your last name? :','s');
disp(['My name is ',Firstname,' ',Lastname]);

University=input('What is your university name? :','s');
disp(['I am a student of ',University])

Standing=input('What is your sanding? :','s');
disp(['I am a ',Standing])

Major=input('What is your Major? :','s');
disp(['My major is ',Major])

years=input('no of years? :','s');
disp(['I will graduate after ',years])

job=input('What is your job? :','s');
disp(['I am looking for a job in ',job])

6.

Firstname = input('What is your first name? :','s');
% 's' indicates that name is a string.
disp([Firstname])

terms=input('no of terms? :','s');
disp([terms])

total=0;
x=0
while x < terms
no_of_class = input('enter no of no of classes for term :');
total=total+no_of_class
x=x+1
disp(['Total no of class ',total])
end
Firstname
total
disp(['Student ',Firstname,' has taken number ',total,' classes'])

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote