How to make the vector the same length

3 visualizzazioni (ultimi 30 giorni)
Jackson
Jackson il 27 Feb 2020
Commentato: Jackson il 27 Feb 2020
Vds = [0.1 0.2 0.3 0.4 0.5 1.0 2.0 4.0 6.0 8.0 10.0];
Vgs = [1.50 2.00 2.25 2.50];
a = [0.2274 0.2931 0.3161 0.3267 0.3317 0.3406 0.3450 0.3540 0.3608 0.3640 0.3666];
b = [2.804 4.299 5.28 6.06 6.33 6.81 7.143 7.62 8.08 8.35 8.63];
c =[6.859 10.852 13.400 15.11 16.25 18.91 18.85];
d= [15.4 25.01];
Im trying to plot(Vds,a,Vds,b,Vds,c,Vds,d) , but it keeps saying that d and c are not the same length as Vds. How do i make it so that c and d are the same length?
  3 Commenti
Guillaume
Guillaume il 27 Feb 2020
"How do i make it so that c and d are the same length?"
Create them so? I'm not sure what answer you expect. You're asking matlab to plot the value of Vds against the values of d. Vds has 11 values, d only two. That makes no sense. You also need 11 values for d (or only choose 2 of the vds values to plot). Only you know what any of the variable represent so only you can fix it.
Jackson
Jackson il 27 Feb 2020
Thank you very much it worked

Accedi per commentare.

Risposte (1)

Fangjun Jiang
Fangjun Jiang il 27 Feb 2020
when you do plot(x,y), x and y need to be same length. So in your code, Vds and d need to be same length, not between c and d
you could do
plot(Vds,a,Vds,b,Vds,c,Vds([1,end]),d)

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by