# Help with 3D plot

1 view (last 30 days)
Mohammed Alharbi on 22 Feb 2022
Commented: Mohammed Alharbi on 28 Feb 2022
Hi,
I am trying to plot a 3D plot to compare two efficiency results, but I was wondering if it's possible to improve the quality of the plot to get clearer results as I am not very familiar with 3D plots. I am trying to get a similar demonstration as the attached image to show the improvement of one result over the other one. In my case, the two surfaces overlap in some parts of the plot, so the differences between the two surfaces aren't so clear. So I would appreciate your help with this, please.
%losses:
clc; clear all ;
rq1 = 0.045; %Rds(on)’s of upper FETs
rq2 = 0.045; %Rds(on)’s of lower FETs
td_on = 65e-9; % Turn-On Delay Time
td_off = 48e-9; % Turn-Off Delay Time
Vsd = 4.1; % Diode Forward Voltage
trr = 70e-9; % Reverse Recovery Time
Qrr = 530e-9; %body-diode reverse-recovery charge
tr = 20e-9; %Rise Time
tf =18e-9; %Falls Time
ph1 = 1;
ph2 = 2;
ph3 = 3;
ph4 = 4;
ph5 = 5;
ph6 = 6;
Po=192e3;
fr=100e3;
T=1/fr;
Vi=1200;
Vo=50:50:800;
Io= 1:1:240;
d= Vo./Vi ;
m1= d*ph1;
m2= d*ph2;
m3= d*ph3;
m4= d*ph4;
m5= d*ph5;
m6= d*ph6;
floor1= floor(m1);
floor2= floor(m2);
floor3= floor(m3);
floor4= floor(m4);
floor5= floor(m5);
floor6= floor(m6);
L=500e-6;
rL=8e-3;
Ipp_ph = (Vo.*(1-d))/(L*fr) ; % Minumum output inductor per phase
P =Vo.*Io';
%Average current per phase I_ph:
Iph1 = Io'./ph1 ;% Output current (per phase)
Iph2 = Io'./ph2 ;% Output current (per phase)
Iph3 = Io'./ph3 ;% Output current (per phase)
Iph4 = Io'./ph4 ;% Output current (per phase)
Iph5 = Io'./ph5 ;% Output current (per phase)
Iph6 = Io'./ph6 ;% Output current (per phase)
% RMS of the inductor currrent per phase, Irms_ph:
Irms_ph1=Iph1.* sqrt(1 + ((1/12).*(Ipp_ph./Iph1).^2)) ;
Irms_ph2=Iph2.* sqrt(1 + ((1/12).*(Ipp_ph./Iph2).^2)) ;
Irms_ph3=Iph3.* sqrt(1 + ((1/12).*(Ipp_ph./Iph3).^2)) ;
Irms_ph4=Iph4.* sqrt(1 + ((1/12).*(Ipp_ph./Iph4).^2)) ;
Irms_ph5=Iph5.* sqrt(1 + ((1/12).*(Ipp_ph./Iph5).^2)) ;
Irms_ph6=Iph6.* sqrt(1 + ((1/12).*(Ipp_ph./Iph6).^2)) ;
%Losess Analysis:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% LOWER MOSFET POWER CALCULATION:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 1) Lower FETs Conduction:
Irms_q2_ph1 = sqrt(((Io'./ph1).^2 + (Ipp_ph.^2./12)) .* (1-d)); % currents conducted through the lower channel resistance (RQ2)
Plow_1_ph1= rq2 * Irms_q2_ph1.^2 ;% The power dissipated in the lower MOSFET per phase
Irms_q2_ph2 = sqrt(((Io'./ph2).^2 + (Ipp_ph.^2./12)) .* (1-d)); % currents conducted through the lower channel resistance (RQ2)
Plow_1_ph2= rq2 * Irms_q2_ph2.^2 ;% The power dissipated in the lower MOSFET per phase
Irms_q2_ph3 = sqrt(((Io'./ph3).^2 + (Ipp_ph.^2./12)) .* (1-d)); % currents conducted through the lower channel resistance (RQ2)
Plow_1_ph3= rq2 * Irms_q2_ph3.^2 ;% The power dissipated in the lower MOSFET per phase
Irms_q2_ph4 = sqrt(((Io'./ph4).^2 + (Ipp_ph.^2./12)) .* (1-d)); % currents conducted through the lower channel resistance (RQ2)
Plow_1_ph4= rq2 * Irms_q2_ph4.^2 ;% The power dissipated in the lower MOSFET per phase
Irms_q2_ph5 = sqrt(((Io'./ph5).^2 + (Ipp_ph.^2./12)) .* (1-d)); % currents conducted through the lower channel resistance (RQ2)
Plow_1_ph5 = rq2 * Irms_q2_ph5.^2 ;% The power dissipated in the lower MOSFET per phase
Irms_q2_ph6 = sqrt(((Io'./ph6).^2 + (Ipp_ph.^2./12)) .* (1-d)); % currents conducted through the lower channel resistance (RQ2)
Plow_1_ph6 = rq2 * Irms_q2_ph6.^2 ;% The power dissipated in the lower MOSFET per phase
% 2) Lower FETs Body-diode Conduction:
Plow_2_ph1= Vsd * fr * ((((Io'./ph1)-(Ipp_ph./2))*tr) + (((Io'./ph1)+(Ipp_ph./2))*tf)); % body-diode conduction loss during the dead time per phase
Plow_2_ph2= Vsd * fr * ((((Io'./ph2)-(Ipp_ph./2))*tr) + (((Io'./ph2)+(Ipp_ph./2))*tf)); % body-diode conduction loss during the dead time per phase
Plow_2_ph3= Vsd * fr * ((((Io'./ph3)-(Ipp_ph./2))*tr) + (((Io'./ph3)+(Ipp_ph./2))*tf)); % body-diode conduction loss during the dead time per phase
Plow_2_ph4= Vsd * fr * ((((Io'./ph4)-(Ipp_ph./2))*tr) + (((Io'./ph4)+(Ipp_ph./2))*tf)); % body-diode conduction loss during the dead time per phase
Plow_2_ph5= Vsd * fr * ((((Io'./ph5)-(Ipp_ph./2))*tr) + (((Io'./ph5)+(Ipp_ph./2))*tf)); % body-diode conduction loss during the dead time per phase
Plow_2_ph6= Vsd * fr * ((((Io'./ph6)-(Ipp_ph./2))*tr) + (((Io'./ph6)+(Ipp_ph./2))*tf)); % body-diode conduction loss during the dead time per phase
% 3) % Total LOWER MOSFET POWER CALCULATION
Plow_ph1 = Plow_1_ph1 + Plow_2_ph1; % the total power dissipated in each lower MOSFET
Plow_ph1_Total = Plow_ph1 * ph1; % The overall lower MOSFETs’ power losses in an N-phase converter
Plow_ph2 = Plow_1_ph2 + Plow_2_ph2; % the total power dissipated in each lower MOSFET
Plow_ph2_Total = Plow_ph2 * ph2; % The overall lower MOSFETs’ power losses in an N-phase converter
Plow_ph3 = Plow_1_ph3 + Plow_2_ph3; % the total power dissipated in each lower MOSFET
Plow_ph3_Total = Plow_ph3 * ph3; % The overall lower MOSFETs’ power losses in an N-phase converter
Plow_ph4 = Plow_1_ph4 + Plow_2_ph4; % the total power dissipated in each lower MOSFET
Plow_ph4_Total = Plow_ph4 * ph4; % The overall lower MOSFETs’ power losses in an N-phase converter
Plow_ph5 = Plow_1_ph5 + Plow_2_ph5; % the total power dissipated in each lower MOSFET
Plow_ph5_Total = Plow_ph5 * ph5; % The overall lower MOSFETs’ power losses in an N-phase converter
Plow_ph6 = Plow_1_ph6 + Plow_2_ph6; % the total power dissipated in each lower MOSFET
Plow_ph6_Total = Plow_ph6 * ph6; % The overall lower MOSFETs’ power losses in an N-phase converter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% UPPER MOSFET POWER CALCULATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 1) Upper FETs Conduction:
Irms_q1_ph1 = sqrt(((Io'./ph1).^2 + (Ipp_ph.^2./12)) .* d); % currents conducted through the lower channel resistance (RQ2)
Pup_1_ph1= rq1 * Irms_q1_ph1.^2; % The power dissipated in the lower MOSFET per phase
Irms_q1_ph2 = sqrt(((Io'./ph2).^2 + (Ipp_ph.^2./12)) .* d); % currents conducted through the lower channel resistance (RQ2)
Pup_1_ph2= rq1 * Irms_q1_ph2.^2; % The power dissipated in the lower MOSFET per phase
Irms_q1_ph3 = sqrt(((Io'./ph3).^2 + (Ipp_ph.^2./12)) .* d); % currents conducted through the lower channel resistance (RQ2)
Pup_1_ph3= rq1 * Irms_q1_ph3.^2; % The power dissipated in the lower MOSFET per phase
Irms_q1_ph4 = sqrt(((Io'./ph4).^2 + (Ipp_ph.^2./12)) .* d); % currents conducted through the lower channel resistance (RQ2)
Pup_1_ph4= rq1 * Irms_q1_ph4.^2; % The power dissipated in the lower MOSFET per phase
Irms_q1_ph5 = sqrt(((Io'./ph5).^2 + (Ipp_ph.^2./12)) .* d); % currents conducted through the lower channel resistance (RQ2)
Pup_1_ph5= rq1 * Irms_q1_ph5.^2; % The power dissipated in the lower MOSFET per phase
Irms_q1_ph6 = sqrt(((Io'./ph6).^2 + (Ipp_ph.^2./12)) .* d); % currents conducted through the lower channel resistance (RQ2)
Pup_1_ph6= rq1 * Irms_q1_ph6.^2; % The power dissipated in the lower MOSFET per phase
% 2) Upper FETs Switching: (note: only UPPER switch experiences switching losses.
Pup_2_ph1 = Vi * fr * ((((Io'./ph1)-(Ipp_ph./2)) * (td_on/2)) + (((Io'./ph1)+(Ipp_ph./2)) * (td_off/2))) ;
Pup_2_ph2 = Vi * fr * ((((Io'./ph2)-(Ipp_ph./2)) * (td_on/2)) + (((Io'./ph2)+(Ipp_ph./2)) * (td_off/2))) ;
Pup_2_ph3 = Vi * fr * ((((Io'./ph3)-(Ipp_ph./2)) * (td_on/2)) + (((Io'./ph3)+(Ipp_ph./2)) * (td_off/2))) ;
Pup_2_ph4 = Vi * fr * ((((Io'./ph4)-(Ipp_ph./2)) * (td_on/2)) + (((Io'./ph4)+(Ipp_ph./2)) * (td_off/2))) ;
Pup_2_ph5 = Vi * fr * ((((Io'./ph5)-(Ipp_ph./2)) * (td_on/2)) + (((Io'./ph5)+(Ipp_ph./2)) * (td_off/2))) ;
Pup_2_ph6 = Vi * fr * ((((Io'./ph6)-(Ipp_ph./2)) * (td_on/2)) + (((Io'./ph6)+(Ipp_ph./2)) * (td_off/2))) ;
Pup_3_ph1 = Vi * Qrr * fr ;
Pup_3_ph2 = Vi * Qrr * fr ;
Pup_3_ph3 = Vi * Qrr * fr ;
Pup_3_ph4 = Vi * Qrr * fr ;
Pup_3_ph5 = Vi * Qrr * fr ;
Pup_3_ph6 = Vi * Qrr * fr ;
% 3) % Total UPPER MOSFET POWER CALCULATION
Pup_ph1 = Pup_1_ph1 + Pup_2_ph1 + Pup_3_ph1;
Pup_ph1_Total = Pup_ph1 * ph1;
Pup_ph2 = Pup_1_ph2 + Pup_2_ph2 + Pup_3_ph2 ;
Pup_ph2_Total = Pup_ph2 * ph2;
Pup_ph3 = Pup_1_ph3 + Pup_2_ph3 + Pup_3_ph3;
Pup_ph3_Total = Pup_ph3* ph3;
Pup_ph4 = Pup_1_ph4 + Pup_2_ph4 + Pup_3_ph4;
Pup_ph4_Total = Pup_ph4 * ph4;
Pup_ph5 = Pup_1_ph5 + Pup_2_ph5 + Pup_3_ph5 ;
Pup_ph5_Total = Pup_ph5 * ph5;
Pup_ph6 = Pup_1_ph6 + Pup_2_ph6 + Pup_3_ph6 ;
Pup_ph6_Total = Pup_ph6 * ph6;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Output Filter Power Losses Calculation
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%1) The output inductor losses
P_inductor_Losses_ph1 = rL *(Irms_ph1).^2;
P_inductor_Losses_ph2 = rL *(Irms_ph2).^2;
P_inductor_Losses_ph3 = rL *(Irms_ph3).^2;
P_inductor_Losses_ph4 = rL *(Irms_ph4).^2;
P_inductor_Losses_ph5 = rL *(Irms_ph5).^2;
P_inductor_Losses_ph6 = rL *(Irms_ph6).^2;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Total Power Losses :
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
P_LossesTotal_ph1 = P_inductor_Losses_ph1 + Pup_ph1_Total + Plow_ph1_Total;
P_LossesTotal_ph2 = P_inductor_Losses_ph2 + Pup_ph2_Total + Plow_ph2_Total;
P_LossesTotal_ph3 = P_inductor_Losses_ph3 + Pup_ph3_Total + Plow_ph3_Total;
P_LossesTotal_ph4 = P_inductor_Losses_ph4 + Pup_ph4_Total + Plow_ph4_Total;
P_LossesTotal_ph5 = P_inductor_Losses_ph5 + Pup_ph5_Total + Plow_ph5_Total;
P_LossesTotal_ph6 = P_inductor_Losses_ph6 + Pup_ph6_Total + Plow_ph6_Total;
%%%%%%%%%%%%%%
%%%%%%%%%%%%%%
%Efficiency:
%%%%%%%%%%%%%%
%%%%%%%%%%%%%%
Eff_Ph1 = (P./(P+P_LossesTotal_ph1)) * 100;
Eff_Ph2 = (P./(P+P_LossesTotal_ph2)) * 100;
Eff_Ph3 = (P./(P+P_LossesTotal_ph3)) * 100;
Eff_Ph4 = (P./(P+P_LossesTotal_ph4)) * 100;
Eff_Ph5 = (P./(P+P_LossesTotal_ph5)) * 100;
Eff_Ph6 = (P./(P+P_LossesTotal_ph6)) * 100;
arr = cat(16,Eff_Ph1,Eff_Ph2,Eff_Ph3,Eff_Ph4,Eff_Ph5,Eff_Ph6);
VPhases=max(arr,[],16); % Compare the columns of each voltage for different number of phases and create an array with maximum values for each column (Variable Active Phase)
%%
[xx,yy]=meshgrid(Vo,Io');
figure (1)
surf(xx,yy,VPhases)
hold on
%surf(xx,yy,zz1)
surf(xx,yy,Eff_Ph6)
hold off
grid on
xlabel('Output Voltage (V)')
ax = gca;
%set(gca,'xLim',[0 800]) % x-axes lim to 0 - 24
set(gca,'yLim',[0 240]) % y-axes lim to 93 - 99
%set(gca,'xTick',0:100:800)% x-axes ticks 0 to 120e3 with 10e3
set(gca,'yTick',0:20:240)% x-axes ticks 93 to 99 with 0.5
%ax.XAxis.Exponent = 3;
ylabel('Output Current (A)')
zlabel('Efficiency %')
legend('With Phase-shedding','Without Phase-shedding');
c = colorbar;
c.Label.String = 'Efficiency (%)';
Regards,
Mohammed
Mohammed Alharbi on 22 Feb 2022
any help pls?

Esha Chakraborty on 24 Feb 2022
Hi Mohammed,
You can convert one of the surface plots into a semitransparent surface by specifying the 'FaceAlpha' name-value pair with 0.5 as the value. You can reduce this value to the extent you want to see the transparency. This will create a distinction between the two surfaces. Please refer to lines 215-221 of your code in the snippet below to see the usage of this arguement, followed by the corresponding plot generated:
You can find the documentation to all the name-value pair arguments of 'surf' plot here.
[xx,yy]=meshgrid(Vo,Io');
figure (1)
s1=surf(xx,yy,VPhases);
hold on
%surf(xx,yy,zz1)
s2=surf(xx,yy,Eff_Ph6,'FaceAlpha',0.5);
hold off
Mohammed Alharbi on 28 Feb 2022
Thanks a lot