Please this code says Error using plot. Vectors must be the same length. Error in untitled2 (line 8) plot(I,V,'0');
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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);
0 commentaires
Réponse acceptée
VBBV
le 7 Nov 2022
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 commentaires
Plus de réponses (2)
Askic V
le 7 Nov 2022
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
le 29 Jan 2024
z1=[2 1+7i; 8i 5+8i]
z2=[1+5i 12+4i; 5i 3+13i]
real(z1)
real(z2)
imag(z1)
imag(z2)
real(z1+z2)
imag(z1+z2)
conj(z1+z2)
Plot(z1+z2,'o')
0 commentaires
Voir également
Catégories
En savoir plus sur Get Started with Symbolic Math Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!