How to make the vector the same length

3 次查看(过去 30 天)
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 个评论
Guillaume
Guillaume 2020-2-27
"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.

请先登录,再进行评论。

回答(1 个)

Fangjun Jiang
Fangjun Jiang 2020-2-27
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)

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by