i do have 2 graphics but I need to find the opposite of their sides

1 次查看(过去 30 天)
i do have 2 graphics but I need to find the opposite of their sides
% Inputs
R = 8.314; % Ideal gas constant (J/molK)
F = 96487; % Faraday’s constant (Coulombs)
Tc = 80; % Temperature in degrees C
P_H2 = 3; % Hydrogen pressure in atm
P_air = 3; % Air pressure in atm
A_cell=100; % Area of cell
N_cells=90; % Number of Cells
r = 0.19; % Internal Resistance (Ohm-cm^2)
Alpha = 0.5; % Transfer coeffi cient
Alpha1 = 0.085; % Amplifi cation constant
io = 10^-6.912; % Exchange Current Density (A/cm^2)
il = 1.4; % Limiting current density (A/cm2)
Gf_liq = - 228170; % Gibbs function in liquid form (J/mol)
k = 1.1; % Constant k used in mass transport
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Convert degrees C to K
Tk = Tc + 273.15;
% Create loop for current
loop = 1;
i = 0;
for N = 0:150;
i = i + 0.01;
% Calculation of Partial Pressures
% Calculation of saturation pressure of water
x = -2.1794 + 0.02953 .* Tc-9.1837 .* (10.^-5) .* (Tc.^2) + 1.4454 .* (10.^-7) .* (Tc.^3);
P_H2O = (10.^x);
% Calculation of partial pressure of hydrogen
pp_H2 = 0.5 .* ((P_H2)./(exp(1.653 .* i./(Tk.^1.334)))-P_H2O);
% Calculation of partial pressure of oxygen
pp_O2 = (P_air./exp(4.192 .* i/(Tk.^1.334)))-P_H2O;
% Activation Losses
b = R .* Tk./(2 .* Alpha .* F);
V_act = -b .* log10(i./io); % Tafel equation
% Ohmic Losses
V_ohmic = -(i .* r);
% Mass Transport Losses
term = (1-(i./il));
if term > 0;
V_conc = Alpha1 .* (i.^k) .* log(1-(i./il));
else
V_conc = 0;
end
% Calculation of Nernst voltage
E_nernst = -Gf_liq./(2 .* F) - ((R .* Tk) .* log(P_H2O./(pp_H2 .* (pp_O2.^0.5))))./(2 .*F);
% Calculation of output voltage
V_out = E_nernst + V_ohmic + V_act + V_conc;
if term < 0;
V_conc = 0;
break
end
if V_out < 0;
V_out = 0;
break
end
figure(1)
title('Fuel cell polarization curve');
xlabel('Current density (A/cm^2)');
ylabel('Output voltage (Volts)');
plot(i,V_out,'o')
grid on
hold on
disp(V_out);
% Calculation of power
P_out = N_cells .* V_out .* i .* A_cell;
figure(2)
title('Fuel cell power');
xlabel('Current density (A/cm^2)');
ylabel('Power(Watts)');
plot(i,P_out,'o');
grid on
hold on
disp(P_out);
end
  3 个评论
sevgul demir
sevgul demir 2022-11-22
i know what my codes makes :) for examle for the first one its starting from the 1.1and going down if i want to make it start from 0 and going up what should i do? thats the question
Image Analyst
Image Analyst 2022-11-22
Yes but you forgot to post the screenshots so no one else who might be able to help you knows what they look like so I thought I'd help out and show them. Otherwise people may simply move on to a different question.
To flip it, you have to change the equation. So when you get V_out, subtract it from the first element:
V_out = V_out(1) - V_out;
and then plot it:
plot(i,V_out,'o')

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by