How to make the vector the same length

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 Kommentare

What values of Vds coorespond to c and d?
plot(Vds,a,Vds,b,Vds([1:7]),c,Vds([1:2]),d);
Guillaume
Guillaume am 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 am 27 Feb. 2020
Thank you very much it worked

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Fangjun Jiang
Fangjun Jiang am 27 Feb. 2020

0 Stimmen

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)

Kategorien

Mehr zu Creating, Deleting, and Querying Graphics Objects finden Sie in Hilfe-Center und File Exchange

Tags

Gefragt:

am 27 Feb. 2020

Kommentiert:

am 27 Feb. 2020

Community Treasure Hunt

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

Start Hunting!

Translated by