Adding surface to a beheaded Gaussian function

10 visualizaciones (últimos 30 días)
Bernd
Bernd el 2 de En. de 2023
Respondida: Bernd el 4 de En. de 2023
I am making a simple model to calculate flows. I have some detailed code below.
The idea is that I have an input flow (gaussian function, yellow) that i chopped of at 1 being the maximum thrueput of the system.
The blue line is fluid left that can not go through the bottleneck at that time. This residue will go through this bottleneck later.
Now I want to add the blue surface to the yellow (decapitaed) gaussian function so that a new decapitated gausian function emerges, with the surface of yellow and blue but with the cap set at 1.
I guess it is more a mathematical question than Matlab or code. Still i woudl appreciate any thoughts or directions. I guess I have to make something with an integrals?
Thansk and happy new year!
Some code extracts:
As input I made a Gaussian function :
x = [0:0.1:24];
params1 = [1 8];
y21 = 1.2*gaussmf(x, params1);
params2 = 0.01*[1 17];
y22 = gaussmf(x, params2);
y24=y21+y22+0.002;
where I chopped of the head.
k1max = 1;
k1=y24+y4;
k1out=k1;
k1out(k1out>k1max)=[k1max];
k1backlog=k1-k1out;
k1backlog(k1backlog<0)=[0];
I now want to add that chopped of surface to the original
  2 comentarios
KALYAN ACHARJYA
KALYAN ACHARJYA el 2 de En. de 2023
What is "y4" here?
Bernd
Bernd el 2 de En. de 2023
Sharp eye :-) I have another gaussian formula in the full code. So k1 is the compound of 2 gaussian inputs.

Iniciar sesión para comentar.

Respuesta aceptada

Bernd
Bernd el 4 de En. de 2023
I found a workarround that works for me. Thanks all for supporting.
What I did: I calculated the sum of the chopped off head.
Rounded it to the next integer.
Made a vector out of it (basicaly converting the cone shape to a rectangual with a surface of the chopped of head.
Inserted that rectangual, after the mean of the gauss.
Not the mathematical most pretiest way but it does the jobe:
s=sum(k1backlog);
T=round(s/kmax1);
T_vector=ones(1,T);
k1outflat=[k1out(1:81) T_vector k1out(82:end)];
k1outflat=[k1outflat(1:241)];
The result is the red line which is

Más respuestas (1)

Sam Chak
Sam Chak el 3 de En. de 2023
I'm not sure if this is what you want because your code doesn't reflect what you described. Anyhow, take a look at the example:
x = [0:0.01:16];
params1 = [1 8];
y21 = 1.2*gaussmf(x, params1) + 0.2;
y24 = min(y21, 1);
params2 = [0.75 8];
y22 = 1.0*gaussmf(x, params2) - 0.5;
y25 = max(y22, 0);
y26 = y24 + y25;
plot(x, y24, x, y25), ylim([0 2]), grid on
plot(x, y26, 'linewidth', 1.5), ylim([0 2]), grid on
  1 comentario
Bernd
Bernd el 3 de En. de 2023
Thanks for the replay and effort Sam. And some need code (with the min and max).
Maybe it is more a mathematical problem than a code one.
As the flow, never can exeed one, by adding the two, I am exeeding one.
So what I guess I want to do is:
1) take the surface of y24,
2) add the surface of y25
3) make a new beheaded gaussian where:
  • surface is y24+y25
  • maximum value is 1
  • params can be bigger than [1 8] (you will get than for example 1.5 and 8.25)
Does that make sence?

Iniciar sesión para comentar.

Categorías

Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.

Productos


Versión

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by