Error using plot Vectors must be the same length.

조회 수: 9 (최근 30일)
iicecont
iicecont 2021년 2월 23일
답변: Jan 2021년 2월 25일
I'm trying to plot ID VDS characteristics for my designed mosfet but after i try to run the code it shows "Error using plot Vectors must be the same length.".
here is my code, thanks in advance
clc; clear all; close all;
%parameters and define variable
syms x y;
un = 17215.771;
Kox = 4.2;
ep0 = 8.854e-12;
x0 = 50e-9;
Cox = ((Kox*ep0)/x0);
VTH = 0.5;
VGS = 2; % [V]
eqna = 20.10364e-6 == 0.5 * un * Cox * (y) * ((VGS - VTH).^2)*(1 + (x * 3.75));
eqnb = 20.34537e-6 == 0.5 * un * Cox * (y) * ((VGS - VTH).^2)*(1 + (x * 4));
eqns = [eqna eqnb];
S = solve(eqns, [x y]);
x = S.x;
y = S.y;
figure(3);
Vgs = (1:0.5:5);
Vds = (0:0.25:5);
[sz1,sz2] = size(Vgs);
for t = (sz1:sz2)
VDSAT2 = Vgs - VTH;
VDSS = (0:0.25:VDSAT2(t));
VDSS2 = Vgs(t) - VTH + 0.25:0.25:5;
IDLinear = un.*Cox.*y.*(((VDSAT2(t)).*VDSS)-((VDSS.^2)/2));
IDSat = 0.5.*un.*Cox.*y.*((VDSAT2(t)).^2).*(1+x.*(VDSS2));
[u,v] = size(VDSS);
[uu,vv] = size(Vds);
for q = (1:v)
ID(t,q) = IDLinear(1,q);
end
for r = (v+1:vv)
IDD(t,r) = IDSat(1,r-v);
end
plot(VDSS,ID,[VDSS2 5],[IDD IDD]);
hold on
end

답변 (1개)

Jan
Jan 2021년 2월 25일
Use the debugger to find the cause of the problem. Type in the command line:
dbstop if error
Run the code again. If it stops, check the sizes of the arguments provided to plot:
size(VDSS)
size(ID)
size([VDSS2 5])
size([IDD IDD])
Something is not matching. Which one?

카테고리

Help CenterFile Exchange에서 Semiconductors and Converters에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by