Question
Write an M-file to evaluate the equation $y(x)=x^{2}-3 x+2$ for all values of $x$ between $0.1$ and 3 , in steps of $0.1$. Do this twice, once with a for loop and once with vectors. Plot the resulting function using a 3 point thick dashed red line.
Step 1
You can do this by opening MATLAB and clicking on "New Script" or typing "edit" in the command window. This will open a new script file where you can write your code. Now, let's write the code for the first part, which is to evaluate the equation using a for Show more…
Show all steps
Your feedback will help us improve your experience
Swati Agarwal and 84 other educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Complete the table of values for each equation, and plot the points. $$ \begin{aligned} &x=3\\ &\begin{array}{c|c} \boldsymbol{x} & \boldsymbol{y} \\ \hline & 0 \\ \hline & -2 \\ \hline & 3 \\ \hline & 1 \end{array} \end{aligned} $$
Linear Equations in Two Variables
Introduction to Linear Equations in Two Variables
Complete the table of values for each equation, and plot the points. $$ \begin{aligned} &y+1=0\\ &\begin{array}{c|c} \hline x & y \\ \hline 0 & \\ \hline 1 & \\ \hline-3 & \\ \hline-1 & \end{array} \end{aligned} $$
Use a CAS to sketch a contour plot. $$f(x, y)=x^{3}-3 x y+y^{2}$$
Functions of Several Variables and Partial Differentiation
Functions of Several Variables
Transcript
Watch the video solution with this free unlock.
EMAIL
PASSWORD