Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This is a homework for MATLAB. Please answer using MATLAB functions and parameters. The answers are to be submitted as a .m script. Don't just
This is a homework for MATLAB. Please answer using MATLAB functions and parameters. The answers are to be submitted as a .m script. Don't just list final answers. Search this paragraph to find other similar questions to answer please.
8 Answers are to be reported as pX= where X is the problem number. * For example the answer to problem i should be reported as pl- $ if it is a single part question, and pla= if it is a multipart $ question. This is how to report your answer for a single part question pl = sind (180); * This is how to report your answer for a multi-part question p2a = exp(-2*pi); p2b = fix (2*pi); p2c = mean (1:5); p2d = 'my answer is ...'; Problem 4: The built-in function clock returns a row vector that contains 6 elements: the first three are the current date (year, month, day) and the last three represent the current time in hours (24 hour clock), minutes, and seconds. The seconds is a real number, but all others are integers. Use function sprintf to accomplish the following formatting exercises. a) Get the current date and time and store them in p4a. The current date and time should be the date and time when the grader calls your script. b) Using the format 'YYYY:MM:DD', write the current date to string p4b. Here, YYYY, MM, and DD correspond to 4-digit year, 2-digit month, and 2-digit day, respectively. c) Using the format 'HH:MM:SS.SSSS', write the current time to string p4c. Here, HH, MM, and SS.SSSS correspond to 2-digit hour, 2-digit minute and 7-character second (2 digits before the decimal point and 4 digits after the decimal points), respectively. d) Remove the last 5 characters from the string in part (c) so that the format is now 'HH:MM:SS'. Put the answer into string p4d. e) Combine the strings in part (b) and part (d) together separated by a single space. Put theanswer in string p4eStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started