limited integration with respect to x in Simulink

6 ビュー (過去 30 日間)
Amr
Amr 2024 年 8 月 28 日
回答済み: Shivam Gothi 2024 年 8 月 29 日
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

回答 (2 件)

Torsten
Torsten 2024 年 8 月 28 日
編集済み: Torsten 2024 年 8 月 28 日
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 件のコメント
Amr
Amr 2024 年 8 月 28 日
The integral is of the form dx / f(y(x))
Torsten
Torsten 2024 年 8 月 29 日
編集済み: Torsten 2024 年 8 月 29 日
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.

サインインしてコメントする。


Shivam Gothi
Shivam Gothi 2024 年 8 月 29 日
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 !!

カテゴリ

Help Center および File ExchangeOrdinary Differential Equations についてさらに検索

製品


リリース

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by