Trying to get plots from range of values

5 views (last 30 days)
Nathaniel Porter
Nathaniel Porter on 18 Feb 2022
Answered: KSSV on 18 Feb 2022
%Base Conditions
a_anode = 0.54;%Anodic transfer coefficient
a_cathode = 0.52;%cathodic transfer coefficient
T = 300; %Cell Temperature
S_anode = 3.5e-3;%Reference kinetic parameter(anode)(A/cm^3)
S_cathode = 1.95e5;%Reference kinetic parameter(cathode)(A/cm^3)
C_oxygen_ref = 1.95e5;%Reference kinetic parameter(cathode)(A/cm^3)
C_oxygen_f = 0.0018; %Feed oxygen concentration(mol/cm^3)
Y_G = 0.5; %Glucose concentration parameter
Y_O2 = 1; %oxygen concentration parameter
B = 0.5; %Hydroxyl ions concentration parameter
L_c = 0.002;%Catalyst layer thickness(cm)
L_d = 0.035;%Diffusion layer thickness(cm)
L_m = 0.0055;%AEM electrolyte thickness(cm)
C_glucose_f = 0.0003; %Feed glucose concentration(mol/cm^3)
C_glucose_ref = 0.0001; %Reference glucose concentration(mol/cm^3)
C_KOH_f = 0.001; %Feed KOH concentration(mol/cm^3)
C_KOH_ref = 0.001; %Reference KOH concentration(mol/cm^3)
E_d = 0.78; %void fraction of the diffusion layer
D_glucose_d = 6.5e-6; %Diffusion coefficient of glucose in KOH(cm^2/s)
D_glucose_f = 6.5e-6; %Diffusion coefficient of glucose in fumion(cm^2/s)
k_w = 1e-10; %Hydraulic permeabilty(cm^2)
u_w = 0.000899; %visocsity of water(Pa-s)
Delta_P = 1200; %Pressure difference across diffusion layer(Pa)
E_s = 0.32; %Volume fraction of solid phase(Pt-Bi/C) in catalyst layer
E_m_anode = 0.08; %Volume fraction of the ionomer in catalyst layer
K_m = 0.008; %Conductivity in OH form in H2O at T=25C(Scm^-1)
K_s = 8.131e5; %Electronic conductivity of solid phase in catalyst layer(Scm)
R_in = 2.6; %Internal resistance of the cell(ohms)
A = 0.75; %geometric area(cm^2)
n_H2O = 2.3; %Electroomsmotic drag coeeficient
P_O2 = 0.5; %oxygen side pressure(atm)
K_O2 = 3.078e5; %O2 Henry's constant(atmcm^3mol^-1)
D_O2 = 0.0056;%Diffusion coefficient of the oxygen in plain medium(cm^2/sec)
E_m_cathode = 0.2; %Volume fraction of the ionomer phase in catalyst layer
E_c =0.6; %Void fraction of the catalyst layer
R = 8.314;%Gas constant
F = 96485;%Faraday constant
I = 0.53e-3;%Current density of fuel cell
n_anode = 2;%number of exchange protons per mole of reactant(glucose)
n_cathode = 4; %number of exchange protons per mole of reactant(anode)
I_l = 1;
E_v = 1.3;
%-------------------------------------------------------------------------
%Activation overpotential
%Anode
%Exchange currenty density
i_O_anode = S_anode *((C_glucose_f/C_glucose_ref))^0.5 ;
%Activation overpotential at anode
V_act_anode = ((R*T)/(n_anode*F*a_anode))*log(I/i_O_anode);
%Cathode
i_O_cathode = S_cathode *((C_oxygen_f/C_oxygen_ref))^0.5 ;
%Activation overpotential at cathode
V_act_cathode = ((R*T)/(n_cathode*F*a_anode))*log(I/i_O_cathode);
%Total activation overpotential
V_act = V_act_cathode + V_act_anode;
%Ohmic Overpotetntial
V_ohmic = I * A * R_in ;
%Concentration overpotential
%Anode
V_conc_anode = ((R*T)/(n_anode*F))*log(1-(I/I_l));
%Cathode
V_conc_cathode = ((R*T)/(n_cathode*F))*log(1-(I/I_l));
%Total concentration overpotential
V_conc = V_conc_cathode + V_conc_anode;
%Real output voltage of cell
V_cell = E_v - V_act - V_ohmic - V_conc;
%Power of fuel cell
P = V_cell * I;
%--------------------------------------------------------------------------
%Plots
%Polarization curve: Cell Potential vs Current density
Trying to get the plots seen above when changing the glucose(C_glucose_f) and oxygen (C_oxygen_f) values in variables.
For glucose a range of [3e-3 to 10e-3] and oxygen [9e-3 to 30e-3].
Example of polarization curve

Accepted Answer

KSSV
KSSV on 18 Feb 2022
I have changed your code. You can plot the variables you want now. You need to read about linspace, element by element operations and plot.
m = 100 ;
%Base Conditions
a_anode = 0.54;%Anodic transfer coefficient
a_cathode = 0.52;%cathodic transfer coefficient
T = 300; %Cell Temperature
S_anode = 3.5e-3;%Reference kinetic parameter(anode)(A/cm^3)
S_cathode = 1.95e5;%Reference kinetic parameter(cathode)(A/cm^3)
C_oxygen_ref = 1.95e5;%Reference kinetic parameter(cathode)(A/cm^3)
% C_oxygen_f = 0.0018; %Feed oxygen concentration(mol/cm^3)
C_oxygen_f = linspace(9e-3,30e-3,m) ;
Y_G = 0.5; %Glucose concentration parameter
Y_O2 = 1; %oxygen concentration parameter
B = 0.5; %Hydroxyl ions concentration parameter
L_c = 0.002;%Catalyst layer thickness(cm)
L_d = 0.035;%Diffusion layer thickness(cm)
L_m = 0.0055;%AEM electrolyte thickness(cm)
% C_glucose_f = 0.0003; %Feed glucose concentration(mol/cm^3)
C_glucose_f = linspace(3e-3,10e-3,m) ;
C_glucose_ref = 0.0001; %Reference glucose concentration(mol/cm^3)
C_KOH_f = 0.001; %Feed KOH concentration(mol/cm^3)
C_KOH_ref = 0.001; %Reference KOH concentration(mol/cm^3)
E_d = 0.78; %void fraction of the diffusion layer
D_glucose_d = 6.5e-6; %Diffusion coefficient of glucose in KOH(cm^2/s)
D_glucose_f = 6.5e-6; %Diffusion coefficient of glucose in fumion(cm^2/s)
k_w = 1e-10; %Hydraulic permeabilty(cm^2)
u_w = 0.000899; %visocsity of water(Pa-s)
Delta_P = 1200; %Pressure difference across diffusion layer(Pa)
E_s = 0.32; %Volume fraction of solid phase(Pt-Bi/C) in catalyst layer
E_m_anode = 0.08; %Volume fraction of the ionomer in catalyst layer
K_m = 0.008; %Conductivity in OH form in H2O at T=25C(Scm^-1)
K_s = 8.131e5; %Electronic conductivity of solid phase in catalyst layer(Scm)
R_in = 2.6; %Internal resistance of the cell(ohms)
A = 0.75; %geometric area(cm^2)
n_H2O = 2.3; %Electroomsmotic drag coeeficient
P_O2 = 0.5; %oxygen side pressure(atm)
K_O2 = 3.078e5; %O2 Henry's constant(atmcm^3mol^-1)
D_O2 = 0.0056;%Diffusion coefficient of the oxygen in plain medium(cm^2/sec)
E_m_cathode = 0.2; %Volume fraction of the ionomer phase in catalyst layer
E_c =0.6; %Void fraction of the catalyst layer
R = 8.314;%Gas constant
F = 96485;%Faraday constant
I = 0.53e-3;%Current density of fuel cell
n_anode = 2;%number of exchange protons per mole of reactant(glucose)
n_cathode = 4; %number of exchange protons per mole of reactant(anode)
I_l = 1;
E_v = 1.3;
%-------------------------------------------------------------------------
%Activation overpotential
%Anode
%Exchange currenty density
i_O_anode = S_anode *((C_glucose_f./C_glucose_ref)).^0.5 ;
%Activation overpotential at anode
V_act_anode = ((R*T)/(n_anode*F*a_anode))*log(I./i_O_anode);
%Cathode
i_O_cathode = S_cathode *((C_oxygen_f./C_oxygen_ref)).^0.5 ;
%Activation overpotential at cathode
V_act_cathode = ((R*T)/(n_cathode*F*a_anode))*log(I./i_O_cathode);
%Total activation overpotential
V_act = V_act_cathode + V_act_anode;
%Ohmic Overpotetntial
V_ohmic = I * A * R_in ;
%Concentration overpotential
%Anode
V_conc_anode = ((R*T)/(n_anode*F))*log(1-(I/I_l));
%Cathode
V_conc_cathode = ((R*T)/(n_cathode*F))*log(1-(I/I_l));
%Total concentration overpotential
V_conc = V_conc_cathode + V_conc_anode;
%Real output voltage of cell
V_cell = E_v - V_act - V_ohmic - V_conc;
%Power of fuel cell
P = V_cell * I;
%--------------------------------------------------------------------------
%Plots
%Polarization curve: Cell Potential vs Current density
plot(P) % Put your variables here

More Answers (0)

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by