please I am getting this error at line 7 Error in code1 (line 7) plot(I, sw_total,'o');

1 view (last 30 days)
Awesome on 13 Nov 2022
Answered: Harshit Gupta on 16 Nov 2022
clear all; close all; clc;
%%Switching Energy Loss vs Collector Current( Fig.13,125oC
sw_on=[0 3.4 4.5 5.55 6.6 7.45 8.05 8.65]*0.001;%mJ
sw_off=[0 1.85 2.1 2.38 2.75 3.2 3.78 4.38]*0.001;%mJ
sw_total=sw_on+sw_off; %mJ
plot(I, sw_total,'o');
x=0:100;
y= -4.2885*10^(-8)*x.^2 + 0.00013567*x -3.0661*10^(-5);
plot(I,sw_total,'ro',x,y);
%%Switching Loss Calculation
Tj= 125;
Vbase=600; Vdc=600;
a=-4.2885*10^(-8);b=0.00013567; c=3.0661*10^(-5);
syms theta;
i=0;
j=0;
for fsw=10000:2000:30000
j=j+1;
i=0;
for I=10:5:100
i=i+1;
F_sw= a*(I*sin(theta))^2 + b*I*sin(theta)+ c;
Cal_sw_loss(i,j) = double((Vdc/(Vbase*2*pi)) *int(F_sw,theta, O, pi)*fsw);
end
end
surf(Cal_sw_loss); hold on; colorbar('Eastoutside');
axis([1 j 1 i 0 100]);
set(gca, 'XTick',1:5:11);
set(gca, 'YTick',1:6:19);
set(gca, 'YTick',0:20:140);
Torsten on 13 Nov 2022
Edited: Torsten on 13 Nov 2022
I don't know how you set "I" in your modified code - so I cannot comment on this.

Harshit Gupta on 16 Nov 2022
As per my understanding, the initial error that you were facing has been resolved by following @Torsten's inputs. And now you are getting the following warning: (I am assuming that you have defined the variable "I", and then you are getting this warning)
Warning: Imaginary parts of complex X and/or Y arguments ignored.
Please refer to the below MATLAB Answers link to resolve this warning:

Categories

Find more on Get Started with MATLAB in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by