Question
Main topics: Function and Plotting Review Open MATLAB Create a Function file named Lab09 Right click Current Folder title of that window Select New File
Main topics: Function and Plotting Review
Open MATLAB
Create a Function file named Lab09
Right click Current Folder title of that window
Select New File by moving mouse to that option
Click on Function in the pop-up menu
Type Lab09 in the highlight field and hit the enter key
Double click the Lab09.m entry (that you just created) in the Current Folder window
Modify the Function file so that it:
Computes the roots of a quadratic function fx=ax2+bx+c, where a0.
To compute these roots, use the quadratic formula:
x= (-bb2-4ac2a) ^(0.5)
Think carefully about the function you have to write:
How many inputs should the function have?
How many outputs?
What should your function do if a=0?
What if a=0 and b=0?
Test your function by calling it with different values. You can write a script for this, or use the Command Window.
For one of your function calls, plot a graph of the quadratic in the appropriate x- and y-axis viewing window to confirm the results of your function. Again, you can write a script for this, or use the Command Window.
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