Azzera filtri
Azzera filtri

limited integration with respect to x in Simulink

63 visualizzazioni (ultimi 30 giorni)
Amr
Amr il 28 Ago 2024 alle 14:14
Risposto: Shivam Gothi il 29 Ago 2024 alle 6:18
i am trying to do this integration but it gives me different results from the calculator or Mathway this is my model for PEM Electrolayzer can you help

Risposte (2)

Torsten
Torsten il 28 Ago 2024 alle 20:06
Modificato: Torsten il 28 Ago 2024 alle 20:23
As far as I can see, the integral is of the form
integral_{x=0}^{x=L} dx / (a*x+b)
for some constant values a and b.
The antiderivative is
1/a * log(a*x+b)
...
  2 Commenti
Amr
Amr il 28 Ago 2024 alle 20:32
The integral is of the form dx / f(y(x))
Torsten
Torsten il 29 Ago 2024 alle 0:01
Modificato: Torsten il 29 Ago 2024 alle 0:02
At least according to your question, the denominator of the function to be integrated (sigma_PEM[lambda(x)]) is a linear function of x. Write down the integrand carefully, and you will see that I'm right.

Accedi per commentare.


Shivam Gothi
Shivam Gothi il 29 Ago 2024 alle 6:18
Hello Amr,
I have tried to solve the above integral by using "ode45" function of MATLAB. I am attaching the matlab script (.m) file ("PEM_function.m") which solves the above integral.
NOTE : Assumptions made : Because we need to provide some initial condition for integral problem to be solved, I am assuming that . But you can change them according to your preference it the script.
The script plots the value of () for different values of membrane thickness (L) ranging from 0 to 0.0001 meters. I am attaching the output generated by the script below.
As seen in the above image, the value of is 8.1256e-7 when L = 0.0001. This agrees with the results of "Mathway" calculator. Also I have evaluated the integral for different values of (L = 45, and ) in "Mathway" calculator and compared with the plot generated by script. The results are matching for all the cases.
If you want to implement in simulink, you can refer to the same code and define a "function block" in simulink window.
I am also attaching the code of file "PEM_function.m" below, in case the file fails to open.
clc;
clear;
%define the initial condition vector
x_initial = 0; %(This is U_ohm_initial, i.e U_ohm at x = 0)
L = 0.0001;
%solve using ode45 matlab inbuilt in function
[x,U_ohm]=ode45(@(x,U_ohm) PEM(x,U_ohm),[0 L],x_initial);
%Plot the U_ohm vs x
figure;
plot(x,U_ohm,'b'); %plot the position of the mass
title('Plot of U_{ohm} vs different values of membrane thickness (L)');
xlabel('Membrane thickness (L)');
ylabel('U_{ohm}');
axx = gca;
axx.FontSize = 12;
disp("The final answer of the integration is ");
x(end)
function U_ohm_dot=PEM(x,U_ohm)
%t is from 0 to L
%Assume U_ohm initial to be 0.
T = 353;
lambda_a = 14; %WATER CONTENT AT THE ANODE MEMBRANE INTERFACE
lambda_c = 10; %WATER CONTENT AT THE CATHODE MEMBRANE INTERFACE
L = 0.000100 ; %Membrane Tickness
lambda_x = ((lambda_a-lambda_c)/L)*x + lambda_c;
sigmaPEM = (0.5139*lambda_x-0.326)*exp(1268*(1/303-1/T));
U_ohm_dot = 1/(sigmaPEM*lambda_x); %The differentiation is performed with respect to x.
end
I hope this helps !!

Prodotti


Release

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by