Adding surface to a beheaded Gaussian function
조회 수: 3 (최근 30일)
이전 댓글 표시
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
채택된 답변
추가 답변 (1개)
Sam Chak
2023년 1월 3일
Hi @Bernd
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Bodies에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!