How can I find where those indesirabe plots are from ?

1 view (last 30 days)
Hello.
I am running the following code:
%% Ids(Vds) %%
mu=10;
Cox=3.9;
W=360*(10^(-9));
L=180*(10^(-6));
K=(mu*Cox)*(W/L);
Vth=1;
vds=0:0.2:20;
vgs=0:0.2:20;
n=length(vgs);
m=length(vds);
for j=1:n
for i=1:m
if vgs(j) < Vth
current(1,i)=0;
elseif vds(i) >= (vgs(j) - Vth)
current(1,i)=0.5* K * (vgs(j) - Vth)^2;
elseif vds(i) < (vgs(j) - Vth)
current(1,i)= K*((vgs(j)-Vth)*vds(i) - 0.5*(vds(i)^2));
hold on
end
plot(vds,current(1,:),'b')
xlabel('Vds (V)')
ylabel('Drain Current (A)')
title('I-V Characteristics of a MOSFET')
end
end
hold off;
And this is what I obtain when I plot the thing you can see in the attached file.
As you can see, there are some vertical plots that made a very beatiful spider-net-shape but this not what I am looking for.
I tried to change, kinda randomly I assume, some things in the loop but it didn't work.
Thank you for your help !
  1 Comment
Abderrahim. B
Abderrahim. B on 24 Aug 2022
So how should look like the plot you want? removing those 'vertical' lines ?

Sign in to comment.

Accepted Answer

Mathieu NOE
Mathieu NOE on 24 Aug 2022
hello
maybe this ?
%% Ids(Vds) %%
mu=10;
Cox=3.9;
W=360*(10^(-9));
L=180*(10^(-6));
K=(mu*Cox)*(W/L);
Vth=1;
vds=0:0.2:20;
vgs=0:0.2:20;
n=length(vgs);
m=length(vds);
for j=1:n
for i=1:m
if vgs(j) < Vth
current(1,i)=0;
elseif vds(i) >= (vgs(j) - Vth)
current(1,i)=0.5* K * (vgs(j) - Vth)^2;
elseif vds(i) < (vgs(j) - Vth)
current(1,i)= K*((vgs(j)-Vth)*vds(i) - 0.5*(vds(i)^2));
hold on
end
end
plot(vds,current(1,:),'b')
xlabel('Vds (V)')
ylabel('Drain Current (A)')
title('I-V Characteristics of a MOSFET')
end
hold off;

More Answers (0)

Products


Release

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!