unable to plot the graph
Show older comments
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');
Accepted Answer
More Answers (1)
Walter Roberson
on 6 Feb 2016
0 votes
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.
Categories
Find more on Directed Graphs 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!