Starting my x-axis values not from zero

7 views (last 30 days)
Nathaniel Porter
Nathaniel Porter on 16 Mar 2022
Commented: Walter Roberson on 17 Mar 2022
Trying to start x-axis which is my current density(j) values from the value 7e-3. Can anyone help out with this.
clc;
clear;
%Variables
m=15;
k = 15;
a_anode = 0.54; %transfer coefficient at anode
a_cathode = 0.52; %transfer coeffiecent at cathode
R = 8.314;%Gas constant
F = 96485;%Faraday constant
T = 300; %Temperature of cell
A_electrodes = 2; %area of electrodes
R_in = A_electrodes*2.5; %Internal resistance of the cell
n_anode = 2; %moles per reactant at the anode
n_cathode =4;%moles per reactant at the cathode
D_anode = 2.4e-6; %diffusion coefficient of glucose in bird
D_cathode = 1.8e-5;%diffusion coefficient of oxygen in bird
d_l_a = 0.005; %diffsuion layer thickness anode
d_l_c= 0.005 ;%diffsuion layer thickness cathode
j = linspace(0.005e-3,0.7e-3,k);%Current density of the cell
jT = j';
C_s_anode = 5.55e-8; %concentration of reactant at the catalyst
C_s_cathode = 1.71e-8; %concentration of reactant at the catalyst
A_anode = 2; %active area of electrode
A_cathode = 2; %active area of electrode
row = 0.005; %diffusion distance
e = 0.4;%porosity of the structure
D_ij_anode = 9.5e-6; %binary diffusion coefficient(glucose in human dura mater)
D_ij_cathode = 1.8e-5;%Diffsuion coefficent of oxyegen in plain medium
i_ref_a = 3.5e-3; %anode reference exchange current density
L_anode = 0.3; %catalyst loading anode
P_anode = 2130; %Pressure at anode
P_ref_anode = 1.2; %reference pressure at the anode
T_ref_anode = 298; %reference temperature at anode
i_ref_c = 1.95e5; %anode reference exchange current density
L_cathode = 0.3; %catalyst loading anode
P_cathode = 50; %Pressure at anode
P_ref_cathode = 700; %reference pressure at the anode
T_ref_cathode = 298; %reference temperature at anode
%%
%Effective exchange current density
%Anode
i0_a = i_ref_a * A_anode * L_anode *(P_anode/P_ref_anode)^0.5 *(-(130/R*T)*(1-(T/T_ref_anode)));
%Cathode
i0_c = i_ref_c * A_cathode * L_cathode *(P_cathode/P_ref_cathode)^1 *(-(66/R*T)*(1-(T/T_ref_cathode)));
%%
%Activation Overpotential
%Anode
V_act_a = (R*T)/(a_anode*n_anode*F)*log(jT/i0_a);%activation potential at anode
V_act_anode = abs(V_act_a);
display(V_act_anode)
%Cathode
V_act_c = (R*T)/(a_cathode*n_cathode*F)*log(jT/i0_c);%activation potential at cathode
V_act_cathode = abs(V_act_c);
display(V_act_cathode)
%Total activation overpotential
V_act = V_act_cathode + V_act_anode;
display(V_act)
%J-V curve
figure
plot(jT,V_act)
title('J-V Vact curve')
xlabel('Current density')
ylabel('Activation overpotential')
%%
%Ohmic overpotential
%R_cell_anode = Rin .* A_anode; %resisitance of fuel cell
%R_cell_cathode = Rin .* A_cathode; %resisitance of fuel cell
%R_cell = R_cell_anode + R_cell_cathode;
V_ohm = jT .* (R_in);%ohmic overpotential of cell
display(V_ohm)
%J-V curve
figure
plot(jT,V_ohm)
title('J-V ohmic curve')
xlabel('Current density')
ylabel('Ohmic overpotential')
%%
%Determining glucose concentration
%Anode
J_diff_anode = jT/(n_anode*F);%diffusion flux of reactants
display(J_diff_anode)
D_eff_anode = (e^1.5) * D_ij_anode;%effective reactant diffusivity
display(D_eff_anode)
C_b_anode = -((J_diff_anode*row)/-D_eff_anode)+ C_s_anode;
C_b_anodeT = C_b_anode';
Glucose_conc = (C_b_anodeT * 180.156)*100000;
%Cathode
J_diff_cathode = jT/(n_cathode*F);%diffusion flux of reactants
display(J_diff_cathode)
D_eff_cathode = (e^1.5) * D_ij_cathode;%effective reactant diffusivity
display(D_eff_cathode)
C_b_cathode = -((J_diff_cathode*row)/-D_eff_cathode)+ C_s_cathode;
%bulk concentration of reactant(oxygen)
display(C_b_cathode)
%%
%Concentration overpotential
%limiting current at anode
i_L_a = (n_anode*F*D_eff_anode*(C_b_anode/d_l_a));
%limiting current at cathode
i_L_c = (n_cathode*F*D_eff_cathode*(C_b_cathode/d_l_c));
%concentration overpotential at anode
%V_conc_anode = (R*T)/(n_anode*F)*log(i_L_a./(i_L_a-j));
V_conc_anode = (R*T)/(n_anode*F)*log(C_b_anode/C_s_anode);
%concentration overpotential at cathode
%V_conc_cathode = (R*T)/(n_cathode*F)*log(i_L_c./(i_L_c-j));
V_conc_cathode = (R*T)/(n_cathode*F)*log(C_b_cathode/C_s_cathode);
%c_anode = (R*T)/(n_anode*F)*log(1/1+a_anode);
%c_cathode = (R*T)/(n_cathode*F)*log(1/1+a_cathode);
%V_conc_anode = c_anode .*log(i_L_a./i_L_a-j);
%V_conc_cathode = c_cathode .*log(i_L_c./i_L_c-j);
%concentration overpotential
V_conc = V_conc_cathode + V_conc_anode;
%J-V curve
figure
plot(jT,V_conc)
title('J-V Vconc curve')
xlabel('Current density')
ylabel('Cocnetration overpotential')
%%
%Cell potential
Et =1.3; %thermodynamic potential of fuel cell
%Fuel cell voltage
V_cell1 = Et - V_act - V_conc - V_ohm;
V_cell = abs(V_cell1);
%%
%Power of fuel cell
P_cell = V_cell .* j;
P_cell1 = abs(P_cell);
%%
%J-V curve
figure
plot(jT,V_cell)
title('J-V curve')
xlabel('Current density')
ylabel('Cell voltage')

Answers (2)

Simon Chan
Simon Chan on 16 Mar 2022
Modify like the following for each plot.
figure
h = plot(jT,V_cell); % Get the data (Modify)
ax=gca; % Get the handle (Modify)
title('J-V curve')
xlabel('Current density')
ylabel('Cell voltage')
ax.XTick(1) = h.XData(1); % <--- Add this line

Star Strider
Star Strider on 16 Mar 2022
Trying to start x-axis which is my current density(j) values from the value 7e-3. Can anyone help out with this.
Probably not, at least not without some clarification. The independent variable is defined as the transpose of ‘j’, defined here as:
j = linspace(0.005e-3,0.7e-3,k);%Current density of the cell
so ‘7e-3’ is outside the xlim range, and ‘7e-4’ is the upper end of the range.
Please clarify what you want to do.
%Variables
m=15;
k = 15;
a_anode = 0.54; %transfer coefficient at anode
a_cathode = 0.52; %transfer coeffiecent at cathode
R = 8.314;%Gas constant
F = 96485;%Faraday constant
T = 300; %Temperature of cell
A_electrodes = 2; %area of electrodes
R_in = A_electrodes*2.5; %Internal resistance of the cell
n_anode = 2; %moles per reactant at the anode
n_cathode =4;%moles per reactant at the cathode
D_anode = 2.4e-6; %diffusion coefficient of glucose in bird
D_cathode = 1.8e-5;%diffusion coefficient of oxygen in bird
d_l_a = 0.005; %diffsuion layer thickness anode
d_l_c= 0.005 ;%diffsuion layer thickness cathode
j = linspace(0.005e-3,0.7e-3,k);%Current density of the cell
jT = j';
C_s_anode = 5.55e-8; %concentration of reactant at the catalyst
C_s_cathode = 1.71e-8; %concentration of reactant at the catalyst
A_anode = 2; %active area of electrode
A_cathode = 2; %active area of electrode
row = 0.005; %diffusion distance
e = 0.4;%porosity of the structure
D_ij_anode = 9.5e-6; %binary diffusion coefficient(glucose in human dura mater)
D_ij_cathode = 1.8e-5;%Diffsuion coefficent of oxyegen in plain medium
i_ref_a = 3.5e-3; %anode reference exchange current density
L_anode = 0.3; %catalyst loading anode
P_anode = 2130; %Pressure at anode
P_ref_anode = 1.2; %reference pressure at the anode
T_ref_anode = 298; %reference temperature at anode
i_ref_c = 1.95e5; %anode reference exchange current density
L_cathode = 0.3; %catalyst loading anode
P_cathode = 50; %Pressure at anode
P_ref_cathode = 700; %reference pressure at the anode
T_ref_cathode = 298; %reference temperature at anode
%%
%Effective exchange current density
%Anode
i0_a = i_ref_a * A_anode * L_anode *(P_anode/P_ref_anode)^0.5 *(-(130/R*T)*(1-(T/T_ref_anode)));
%Cathode
i0_c = i_ref_c * A_cathode * L_cathode *(P_cathode/P_ref_cathode)^1 *(-(66/R*T)*(1-(T/T_ref_cathode)));
%%
%Activation Overpotential
%Anode
V_act_a = (R*T)/(a_anode*n_anode*F)*log(jT/i0_a);%activation potential at anode
V_act_anode = abs(V_act_a);
display(V_act_anode)
V_act_anode = 15×1
0.3167 0.2594 0.2440 0.2347 0.2280 0.2227 0.2185 0.2148 0.2117 0.2089
%Cathode
V_act_c = (R*T)/(a_cathode*n_cathode*F)*log(jT/i0_c);%activation potential at cathode
V_act_cathode = abs(V_act_c);
display(V_act_cathode)
V_act_cathode = 15×1
0.2984 0.2687 0.2606 0.2558 0.2523 0.2496 0.2474 0.2455 0.2439 0.2424
%Total activation overpotential
V_act = V_act_cathode + V_act_anode;
display(V_act)
V_act = 15×1
0.6151 0.5281 0.5046 0.4904 0.4803 0.4723 0.4658 0.4603 0.4555 0.4513
%J-V curve
figure
plot(jT,V_act)
title('J-V Vact curve')
xlabel('Current density')
ylabel('Activation overpotential')
% xlim([7E-3 max(xlim)])
%%
%Ohmic overpotential
%R_cell_anode = Rin .* A_anode; %resisitance of fuel cell
%R_cell_cathode = Rin .* A_cathode; %resisitance of fuel cell
%R_cell = R_cell_anode + R_cell_cathode;
V_ohm = jT .* (R_in);%ohmic overpotential of cell
display(V_ohm)
V_ohm = 15×1
0.0000 0.0003 0.0005 0.0008 0.0010 0.0013 0.0015 0.0018 0.0020 0.0023
%J-V curve
figure
plot(jT,V_ohm)
title('J-V ohmic curve')
xlabel('Current density')
ylabel('Ohmic overpotential')
%%
%Determining glucose concentration
%Anode
J_diff_anode = jT/(n_anode*F);%diffusion flux of reactants
display(J_diff_anode)
J_diff_anode = 15×1
1.0e-08 * 0.0026 0.0283 0.0540 0.0798 0.1055 0.1312 0.1569 0.1827 0.2084 0.2341
D_eff_anode = (e^1.5) * D_ij_anode;%effective reactant diffusivity
display(D_eff_anode)
D_eff_anode = 2.4033e-06
C_b_anode = -((J_diff_anode*row)/-D_eff_anode)+ C_s_anode;
C_b_anodeT = C_b_anode';
Glucose_conc = (C_b_anodeT * 180.156)*100000;
%Cathode
J_diff_cathode = jT/(n_cathode*F);%diffusion flux of reactants
display(J_diff_cathode)
J_diff_cathode = 15×1
1.0e-08 * 0.0013 0.0142 0.0270 0.0399 0.0527 0.0656 0.0785 0.0913 0.1042 0.1171
D_eff_cathode = (e^1.5) * D_ij_cathode;%effective reactant diffusivity
display(D_eff_cathode)
D_eff_cathode = 4.5537e-06
C_b_cathode = -((J_diff_cathode*row)/-D_eff_cathode)+ C_s_cathode;
%bulk concentration of reactant(oxygen)
display(C_b_cathode)
C_b_cathode = 15×1
1.0e-05 * 0.0031 0.0173 0.0314 0.0455 0.0596 0.0738 0.0879 0.1020 0.1161 0.1302
%%
%Concentration overpotential
%limiting current at anode
i_L_a = (n_anode*F*D_eff_anode*(C_b_anode/d_l_a));
%limiting current at cathode
i_L_c = (n_cathode*F*D_eff_cathode*(C_b_cathode/d_l_c));
%concentration overpotential at anode
%V_conc_anode = (R*T)/(n_anode*F)*log(i_L_a./(i_L_a-j));
V_conc_anode = (R*T)/(n_anode*F)*log(C_b_anode/C_s_anode);
%concentration overpotential at cathode
%V_conc_cathode = (R*T)/(n_cathode*F)*log(i_L_c./(i_L_c-j));
V_conc_cathode = (R*T)/(n_cathode*F)*log(C_b_cathode/C_s_cathode);
%c_anode = (R*T)/(n_anode*F)*log(1/1+a_anode);
%c_cathode = (R*T)/(n_cathode*F)*log(1/1+a_cathode);
%V_conc_anode = c_anode .*log(i_L_a./i_L_a-j);
%V_conc_cathode = c_cathode .*log(i_L_c./i_L_c-j);
%concentration overpotential
V_conc = V_conc_cathode + V_conc_anode;
%J-V curve
figure
plot(jT,V_conc)
title('J-V Vconc curve')
xlabel('Current density')
ylabel('Cocnetration overpotential')
%%
%Cell potential
Et =1.3; %thermodynamic potential of fuel cell
%Fuel cell voltage
V_cell1 = Et - V_act - V_conc - V_ohm;
V_cell = abs(V_cell1);
%%
%Power of fuel cell
P_cell = V_cell .* j;
P_cell1 = abs(P_cell);
%%
%J-V curve
figure
plot(jT,V_cell)
title('J-V curve')
xlabel('Current density')
ylabel('Cell voltage')
.
  5 Comments
Walter Roberson
Walter Roberson on 17 Mar 2022
You can upload anything if you zip it first.

Sign in to comment.

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by