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!