Answered step by step
Verified Expert Solution
Question
1 Approved Answer
please do all parts, and include scripts from matlab. thank you! 7. (A * m script file is required for this question) at. Write a
please do all parts, and include scripts from matlab. thank you!
7. (A * m script file is required for this question) at. Write a line of code that asks the user what their favorite number is, that only accepts numerie input, and saves the answer in variable D1. b. Write a line of code that asks the user what their favorite color is, that only accepts string input, and saves the answer in variable D2. c. Construct a 12 string matix L1 where the string "ENERGETIC" is the first element and the string "TIRED' is the second element. d. Using the menu command, write a line of code that asks the User (via GUD) whether they are feeing "ENERGETIC" or "TIRED", and saves the selection in variable D3. You should be using L1 in your answer. e. Write a line of code that shows the variable D3 and its value, without using frrintt, 1. Display the option user picked in part (d). If the user picked ENERGETIC", you should print "ENERGETIC". If the user picked "TIRED', you shoukd print "TIRED". You cannot use if or switch statements. (Hint: Think about indexing. you should be using L1 in your answer. For string matrix L1, use L1{1} or L1{2} to access the aiements). 9. Write a line of code that shows the variable D3 and its value, by using torinte. h. Write a line of code that shows the value of D2, with 8 without using fotinte. 6. Write a line of code using forintf, that forms output based on user's previous inputs from parts a,b, and c : "Your favorite number is 3, and your favorite color is blue. You are feeling ENERGETIC loday. " 1. Create the variable named D4=5+12. Using fpoint, write a line of code that prints the following result: "The imaginary part is 12 and the real part is 5.". DO NOT hard code the 5 and 12 in the code to be displayed Step 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