Please this code says Error using plot. Vectors must be the same length. Error in untitled2 (line 8) plot(I,V,'0');

5 次查看(过去 30 天)
clear all; close all; clc;
%%VCE vs. IC (Fig.3, 125oC, VGE=15V)
I=[10 20 30 30 40 50 60 70 80 90 100];
V=[1.5 1.9 2.2 2.5 2.77 3 3.25 3.5 3.72 3.95];
plot(I,V,'o');
x=10:100;
y=-7.9167*10^(-5)*x.^2 + 0.035236*x + 1.1958;
plot(I,V,'o',x,y);
%%Conduction Loss Calculation
Tj= 125; fsw=20000;
a=-7.9167*10^(-5);b=0.035236; c=1.1958;
I=40; M=0.5;
syms theta;
i=0;
j=0;
for M=0.2:0.05:0.8
j=j+i;
duty=0.5*0.5*M*sin(theta);
i=0;
for I=10:5:100
i=i+1;
F_cond=I*sin(theta)*(a*(I*sin(theta))^2+b*I*sin(theta)+c);
Cal_cond_loss(i,j)=double(int(duty*F_cond,theta,0,pi))/(2* pi);
end
end
surf(Cal_cond_loss); hold on; colorbar('Eastoutside');
axis([1 j 1 i 0 100]);
set(gca, 'XTick',1:4:13);
set(gca, 'YTick',1:6:19);

采纳的回答

VBBV
VBBV 2022-11-7
I=[10 20 30 30 40 50 60 70 80 90 100];
V=[1.5 1.9 2.2 2.5 2.77 3 3.25 3.5 3.72 3.95 4]; % this vector has less number of elements
V has only 10 elements
i=0;
j=0;
for M=0.2:0.05:0.8
j=j+1; % change it to 1 and try

更多回答(2 个)

Askic V
Askic V 2022-11-7
It is because I has 11 elements and V has only 10 elements. Thy should have the same number of elements to plot them as (x,y) pairs.

salman
salman 2024-1-29
z1=[2 1+7i; 8i 5+8i]
z1 =
2.0000 + 0.0000i 1.0000 + 7.0000i 0.0000 + 8.0000i 5.0000 + 8.0000i
z2=[1+5i 12+4i; 5i 3+13i]
z2 =
1.0000 + 5.0000i 12.0000 + 4.0000i 0.0000 + 5.0000i 3.0000 +13.0000i
real(z1)
ans = 2×2
2 1 0 5
real(z2)
ans = 2×2
1 12 0 3
imag(z1)
ans = 2×2
0 7 8 8
imag(z2)
ans = 2×2
5 4 5 13
real(z1+z2)
ans = 2×2
3 13 0 8
imag(z1+z2)
ans = 2×2
5 11 13 21
conj(z1+z2)
ans =
3.0000 - 5.0000i 13.0000 -11.0000i 0.0000 -13.0000i 8.0000 -21.0000i
Plot(z1+z2,'o')
Unrecognized function or variable 'Plot'.

类别

Help CenterFile Exchange 中查找有关 Word games 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by