Clear Filters
Clear Filters

I am trying to plot Id Vs Vds of AlGaN HEMT. I have written the code but I am getting a straight line. Please check this code

7 views (last 30 days)
clc;
clear all;
m=0.23; %#1%
q=1.6e-19;
d1=22e-7;
d2=1e-7;
fis=1.4*m+0.87;
deff=23.01e-7;
%detaEg=6.13*m+(1-m)*3.42-m*(1-m)+(m-1)*3.42;
detaEc=0.862*1.602e-19;
EA=10.31;
EF=2.1;
deta2deg=0.25*1.602e-19;
deff=d1+d2+deta2deg;
r1=q*EA/deff;
r2=fis+(EF-(detaEc)/q);
Esat=190*10^5;
vs=2.1*10^5;
mu=1380*10^-4;
z=100e-6;
r3=vs*Esat/sqrt(Esat^2+(vs/mu)^2);
vgs=2;
Vds=0:0.01:10;
Idsat=zeros(size(Vds));
m=length(Vds);
for i=1:m
Idsat(i)=r1.*(vgs-(r2)+Vds(i))*z*r3;
i=i+1;
end
xlabel('vds');
ylabel('Idsat');
plot(Vds,Idsat)

Answers (1)

sai charan sampara
sai charan sampara on 25 Sep 2023
Hello Nudrat,
I understand that you are trying to plot the relation between variables Id and “Vds”. In the code mentioned above “Vds” is an array of values from 0 to 10 and “Idsat” is defined in a for loop as
Idsat(i)=r1.*(vgs-(r2)+Vds(i))*z*r3;
In this equation the parameters “r1”, “vgs”, “r2”, “z”, “r3” are all scalars of constant value. Hence the relation between “Idsat” and “Vds” is of the form “Ids=m*Vds+c” which is the equation of a straight line. Hence the graph is correct with respect to the equations provided.
If the output is not as expected, then there might be an error in the equations governing the parameters or an error in the relation between the two variables.
You can recheck the equations and check whether there is any mistake or inconsistency in them. Also check if the variable you have plotted is the one you require.
I hope this helps.
Thanks,
Charan.

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!