Assignment for MatLab 243
March 17th, 2023
Im trying to study for my Computer Science course and I need some help to understand this question.
Don't use plagiarized sources. Get Your Custom Essay on
Assignment for MatLab 243
From $8/Page
- 1. Write an input statement that will prompt the user for a real number, and store it in a variable.Then, use the fprintf function to print the value of this variable using 2 decimal places.
- Answer:
- 2. When would you use disp instead of fprintf?When would you use fprintf instead of disp?
Answer:
- 3. Trace the following code and determine what will be printed after each line is executed.
num = 12.3;
disp(‘Hello!’)
fprintf ( ‘ Hmm how many ‘)
fprintf( ‘ lines n nwill print? n’ )
fprintf( ‘ %6.2f n’, num)
Answer:
Line1:
Line2:
Line3:
Line4:
Line5:
- 4. When would it be important to use legend in a plot?
- Answer:
5. Write a script that would create a 3×5 matrix of random integers and write this new matrix to a file called Assignment3_Question5.dat.
Answer: