MATLAB: How do you input this function

circuits

K = Gain of the amplifier = 12.5.
Vi = input voltage -2.5 < Vi < 2.5 V, (use 0.25 increments).
V+ = positive power supply voltage, V+ = +20 V.
V- = negative power supply voltage V- = -20V.
Vo = output voltage
Vo = -KVi
How do i input the range of voltage into matlab? I am stuck on what to do. I am supposed to plot the output voltage

Best Answer

Do you want to interactively ask the user for them? If so, look at inputdlg(). There are examples in the help. Otherwise just hard code them into your code like
positiveV = 20;
negativeV = -20;
Vi = -2.5 : 0.25 : 2.5; % Alternatively use linspace()