MATLAB: My matlab code can not plot line, please help

functionplotplotting

I want to draw the plot for the relation of Ids-Vds that given by following equations, when Vds>Vds_sat, Ids=Ids_sat:
My code is attached below, it can not plot anything and I don't know why… Can someone gives me some hint about why it can't print anything? Thanks!
% code
vds = 0:1/1000:0.8; %Vds, from 0V to 5V
vgs_vth1 = 1; %Vgs - Vth = 1V
vds_sat = (2*(vgs_vth1))/(1+sqrt(1+vgs_vth1));
disp(vds_sat);
if(vds <= vds_sat)
Ids = (500*(1.04*10^-5)*10*(vgs_vth1*vds-0.5*vds.^2))/(1+0.5*vds);
else
Ids = (500*(1.04*10^-12/10^-7)*10*(vgs_vth1*vds_sat-0.5*vds_sat.^2))/(1+0.5*vds_sat);
end
plot(vds,Ids);
axis([0 0.8 0 2]);
title('Ids-Vds Curve');
xlabel({'Vds/V'});
ylabel({'Ids/A'});

Best Answer

Replace vds_sat line with this:
vds_sat=(2*(vgs_vth1))/(1+sqrt(1+vgs_vth1))*ones(1,length(vds));
Edit:
for i=1:length(vds)
if(vds(i) <= vds_sat(i))
Ids(i) = (500*(1.04*10^-5)*10*(vgs_vth1*vds(i)-0.5*vds(i).^2))/(1+0.5*vds(i));
else
Ids(i) = (500*(1.04*10^-12/10^-7)*10*(vgs_vth1*vds_sat(i)-0.5*vds_sat(i).^2))/(1+0.5*vds_sat(i));
end