unable to plot the graph
Afficher commentaires plus anciens
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');
Réponse acceptée
Plus de réponses (1)
Walter Roberson
le 6 Fév 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.
Catégories
En savoir plus sur Directed Graphs dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!