hope to add the graph line, It is basic please help
    4 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    whiyan
 el 21 de Oct. de 2020
  
    
    
    
    
    Respondida: Star Strider
      
      
 el 21 de Oct. de 2020
            The below is the current result. (just 1 Vgs line)

However,  i want that my graph is to be like the below. (4 Vgs lines) 

My current coding is the below. what should i do just for adding the Vgs line?? (Ignore numeric values)
====================================
clear all;
W=40;
Vth=0.45;
Leff=0.15;
k=4.255*(10^-4)*(W/Leff);
lambda=25*10^-5;
Vds=linspace(0,2.5);
vgs=0.7;
m=length(Vds);
for i=1:m
if vgs < Vth
current(1,i)=0;
elseif Vds(i) >= (vgs - Vth)
current(1,i)=0.5* k * ((vgs - Vth)^2);
elseif Vds(i) < (vgs - Vth)
current(1,i)= k*((vgs-Vth)*Vds(i) - 0.5*(Vds(i)^2)); 
end
end
plot(Vds,current(1,:),'b')
0 comentarios
Respuesta aceptada
  Star Strider
      
      
 el 21 de Oct. de 2020
        Create a vector out of the ‘vgs’ quantities you want to plot: 
vgs=[0.7 1 1.5 2];
then use a second loop to index them: 
W=40;
Vth=0.45;
Leff=0.15;
k=4.255*(10^-4)*(W/Leff);
lambda=25*10^-5;
Vds=linspace(0,2.5);
vgs=[0.7 1 1.5 2];
m=length(Vds);
for k1 = 1:numel(vgs)
for i=1:m
    if vgs(k1) < Vth
        current(k1,i)=0;
    elseif Vds(i) >= (vgs(k1) - Vth)
        current(k1,i)=0.5* k * ((vgs(k1) - Vth).^2);
    elseif Vds(i) < (vgs(k1) - Vth)
        current(k1,i)= k*((vgs(k1)-Vth)*Vds(i) - 0.5*(Vds(i).^2));
    end
end
end
figure
plot(Vds,current, 'LineWidth',1.5)
grid
legend(compose('V_{GS} = %0.1f V', vgs), 'Location','NW')
0 comentarios
Más respuestas (0)
Ver también
Categorías
				Más información sobre Semiconductors and Converters en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

