Question: Using matlab No Service 10:18 AM K ENGRS HW2 Assignment $19.docx 5. Write a script that will calculate the volume of a hollow sphere, given
No Service 10:18 AM K ENGRS HW2 Assignment $19.docx 5. Write a script that will calculate the volume of a hollow sphere, given by the equation: Where r, is the inner radius and r, is the outer radius. User 5 and r 6, and display the result to two decimal places formatted exactly as shown below >Volume of hollow sphere is: 381.18 6. Write an input statement that prompts the user for a real number, and stores it in a variable. Then use the fprintf function to print the value of this variable using 2 decimal places, as shown: >> Please enter a number: 3.4234 >> Your number is 3.42 7. Experiment in the Command Window with using the fprintf function for real numbers. Use fprintf to print the real number 12345.6789 Without specifying field width field width 10 with 4 decimals field width 10 with 2 decimals field width 6 with 4 decimals field width 2 with 4 decimals 8. Plot exp(x) for values of x ranging from -2 to 2 in steps of 0.1. Place an appropriate title on the plot and label the axes. 9. Plot sin(x) for x values ranging from 0 to pi (a) using 10 pts (b) using 100 pts in the range. (Hint: use linspace) Dashboard Calendar To Do Notifications Inbox
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
