MATLAB 2013.b supports direct integration.
It supports both definite and indefinite integrals.
However, if complicated functions are given you will see a message in the command window stating that the explicit integral could not be found. For definite integrals, the approximate result can be obtained by using 'double' function for the result of integration. If the integration results in a singular result, this won't work.
Format:
syms x;
y=int(sin(x),x);
The first line is for declaring 'x' as a symbolic variable.
This will result in
y=-cos(x)
If you are using definite integral,if you enter double(y), it will return the approximate value of the integration.
Try some examples on your own.
Showing posts with label MATLAB PROGRAM. Show all posts
Showing posts with label MATLAB PROGRAM. Show all posts
Tuesday, January 28, 2014
Sunday, December 23, 2012
MATLAB code for n-channel enhancement MOSFET with early effect
Enhancement mode MOSFET is influenced by early effect that
arises in short channel devices. Since we are dealing with 180nm technology the
devices are prone to short channel effects. This channel length modulation
introduces an additional term in the MOSFET equation. It’s represented as ‘λ’
but is different from the device parameter used for expressing sizes of
transistor parts. It’s the inverse of early voltage. The implication can be
understood by observing the output characteristics. The curve influence by
channel length modulation will develop a slope corresponding to the early
voltage in the saturation region of the output characteristic of the NMOSFET. This
video gives a better explanation to the working of MOSFET and guides you
through the implementation of code and interpretation of graphs.
MATLAB CODE
%n-channel enhancement mode
MOSFET output characteristics
clear all;
%kn=un*cox = 100
microA/Volts
kn=1e-4;
%Let W/L= 2
W=360*(10^(-9));
L=180*(10^(-9));
beta=kn*W/L;
%Vth is the threshold
voltage
Vth=1;
%lambda is the inverse of
early voltage in voltage inverse
lambda=1/1000;
%Sweep drain to source
voltge from 0 to 10V
vds=0:0.5:10;
%Ask the user to enter gate
to source voltage
vgs=input('ENTER THE Vgs
in volts');
%Estimate length of the
array
m=length(vds);
for i=1:m
if vgs < Vth
current(1,i)=0;
current1(1,i)=0;
elseif vds(i) >=
(vgs - Vth)
current(1,i)=0.5* beta * ((vgs -
Vth)^2)*(1+lambda*vds(i));
current1(1,i)=0.5* beta * ((vgs -
Vth)^2);
elseif vds(i) <
(vgs - Vth)
current(1,i)=
beta*((vgs-Vth)*vds(i) - 0.5*(vds(i)^2))*(1+lambda*vds(i));
current1(1,i)=beta*((vgs-Vth)*vds(i)
- 0.5*(vds(i)^2));
end
end
plot(vds,current(1,:),'b',vds,current1(1,:),'r')
xlabel('Vds, V')
ylabel('Drain
Current,A')
title('I-V
Characteristics of a MOSFET')
OUTPUT CHARACTERISTICS
In this graph, the early voltage is 200V. So the effect is higher than the case following this. The output characteristics have been highly modified with the help og graph editor in MATLAB to help viewers explore them.
In this graph the early voltage is 1000 V. Therefore, the curve is not so sloppy. This is the original appearance of the output curve without any modification. In other words, this curve obeys the code!Saturday, December 22, 2012
MATLAB code for n-channel MOSFET output characteristics
MOSFET is the most widely used semiconductor device in the present era. It's important to understand the working of MOSFET and graphical explanation helps in obtaining a fairly good idea on MOSFETs. Here is the MATLAB code for plotting the output characteristics of an n-channel MOSFET. The graph is also given below.
Use this video for VIDEO and AUDIO guidance and better explanation.
180 nm technology is assumed since it is the latest in use.
Early effect is not considered.
Early effect is not considered.
MATLAB code
%n-channel enhancement mode MOSFET output characteristics
clear all;
%kn=un*cox = 100 microA/Volts
kn=1e-4;
%Let W/L= 2
W=360*(10^(-9));
L=180*(10^(-9));
beta=kn*W/L;
%Vth is the threshold voltage
Vth=1;
%Sweep drain to source voltge from 0 to 10V
vds=0:0.5:10;
%Ask the user to enter gate to source voltage
vgs=input('ENTER THE Vgs in volts');
%Estimate length of the array
m=length(vds);
for i=1:m
if vgs < Vth
current(1,i)=0;
elseif vds(i) >= (vgs - Vth)
current(1,i)=0.5* beta * (vgs - Vth)^2;
elseif vds(i) < (vgs - Vth)
current(1,i)= beta*((vgs-Vth)*vds(i) - 0.5*(vds(i)^2));
end
end
plot(vds,current(1,:),'b')
xlabel('Vds, V')
ylabel('Drain Current,A')
title('I-V Characteristics of a MOSFET')
OUTPUT CHARACTERISTICS
Vgs=4V
Friday, December 10, 2010
MATLAB PROGRAM FOR AUTO-CORRELATION (DIGITAL SIGNAL PROCESSIING)
clear all;
x=input('enter the sequence x=');
N=length(x);
y=x;
z=x;
for i=1:N-1
for i=N-1:-1:1
x(i+1)=x(i);
end
x(1)=0;
z=[z; x];
end;
m=[z]*[y'];
m=m/N
stem(m);
title('auto-correlation');
xlabel('time index');
ylabel('amplitude');
Subscribe to:
Posts (Atom)

