V_s  = 5;
V_tm = 1.95;
R    = 1;
K    = 52.78;

V_in  = linspace(V_tm,2.340,500);
V_out = V_s - 0.5*R*K*(V_in-V_tm).^2;

plot(V_in, V_out);
grid on;
xlabel('V_{in} in V');
ylabel('V_{out} in V');
title('6.002 Lab 2, Exercise 2-1b');
xlim([1.5 3]);
ylim([0 6]);

hold on;

% Measured data
VM_in  = [0 2.164 2.244 2.296 2.340];
VM_out = [5 4 3 2 1];
plot(VM_in, VM_out, 'ro');
