MATLAB: How to plot a simple function that has a variable

functionMATLABmatlab functionplotquadratic

The question I have is:
Write a MATLAB function
func(x,a) = x^2 + ax – 6
Use the function to plot, func(x,1), func(x,2) and func(x,3) on the same axes, for -10<x<10.
Im really confused how to define a as 1, 2 and 3 and how to substitute them into the function.

Best Answer

Read about fplot()
syms x
for a=1:3
func = x^2 + a*x - 6 ;
fplot(func,[-10 10]) %ranging from -10 to 10
hold on
end
Screen Shot 2018-11-16 at 8.00.07 PM.png