Question
Matlab Lab 5 Directions 1. Create a new script and save it as Lab5.m. Add commands to: 2. When learning to program, the first program
Matlab Lab 5
Directions 1. Create a new script and save it as Lab5.m. Add commands to: 2. When learning to program, the first program that students often write after learning input and output is a program that outputs the phrase Hello World!. Save the character string Hello World! to a variable message. Have your script output the Hello World! message using disp. Now output the message string using fprintf followed by a newline . 3. Next, add a line of code asking the user to enter a number, and save this user input to a variable. 4. Use fprintf to output 6 statements, one for each of the trig functions sin, cos, tan, sec, csc, cot that outputs a short message telling the user the value of each trig function evaluated at their input from Step 3. Format the numeric values to use a precision of 4 (fixed, f) for sine and cosine, and precision of 4 (exponential, e) for the other four. Example, if the user inputs pi: sin(3.1416) = 0.0000 5. Now prompt the user for a row or column vector (you may want to comment out previous lines in your script so you dont have to input new values each time you run it). Print out the mean, median, and std. deviation of the values, again formatted in such a way that the user knows what they are. You could use fprintf or just disp. 6. Go to the webpage https://gist.github.com/curran/a08a1080b88344b0c8a7#file-iris-csv and look at how the data Iris.csv is formatted into 5 columns, with headers sepal length, etc. Use fprintf to print out the first 2 rows of this table, plus the header row, exactly as it appears on the webpage. (Hint: if you want to copy and paste some values to save typing, use the Raw button in the top right of the table.) 7. Plot the function y = x 3 ? 5x + 1 with plot or fplot and use ginput to try to find the approximate locations of any x-intercepts. 8. Upload your script Lab5.m to Canvas under Assignments -> Lab 5.
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