unable to plot the graph
이전 댓글 표시
Hey, I am trying this code to generate a graph between voltage (x axis) and resistance(y axis), but i get an error saying the index aren't of the same length. below is the code, please advice..
close all;
clear all;
un=2000*10^-4;
cox=10*10^-3;
vtn=0.4;
wl=1;
kn=un*cox*wl;
vgs=4;
vds=0:5;
m=length(vds);
for i=1:m
if vgs>vtn
if vds(i)<vgs-vtn
rdsl(i)=1./kn*(vgs-vtn-vds(i));
elseif vds(i)>vgs-vtn
rdss(i)=0;
end
end
end
plot(vds,rdsl(i));
xlabel('voltage vds');
ylabel('resistance rds');
title('qualitative graph between voltage and resistance');
채택된 답변
추가 답변 (1개)
Walter Roberson
2016년 2월 6일
0 개 추천
You assign to rdsl in one place and to rdss in another. As a result, the two arrays might not end up the same length.
카테고리
도움말 센터 및 File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!