필터 지우기
필터 지우기

Filled region between three functions

조회 수: 2 (최근 30일)
Rasmus Bruun
Rasmus Bruun 2024년 3월 1일
편집: Mathieu NOE 2024년 3월 1일
I would like to shade the region inbetween [sigma1, Friction], [sigma1, Friction2] and [sigma2, Tension_failure]. I have shaded the area between the two first functions but I don'tknow how to restrict the curve to the third function.
Forhold = 1/2 ;
Forhold2 = 54/228;
f_vk0 = 0.4 ; % Klæbningsbidrag [MPa]
mu_k = 0.65 ; % Friktionskoefficient
f_bt = 1.00 ; % Trækstyrke af sten [MPa]
f_k = 10.00 ; % Trykstyrke af sten [MPa]
sigma1 = -0.0:0.1:1.4 ;
sigma2 = 0.1:0.1:10 ;
sigma3 = 8.5:0.1:10 ;
sigma23 = 9.2:0.1:10 ;
Friction = (f_vk0 + mu_k * sigma1) / (1 + mu_k * 2 * Forhold) ;
Tension_failure = f_bt / 2.3 * sqrt(1 + sigma2/f_bt) ;
Compression_failure = (f_k - sigma3) * 1/Forhold*(1/2) ;
Friction2 = (f_vk0 + mu_k * sigma1) / (1 + mu_k * 2 * Forhold2) ;
Tension_failure = f_bt / 2.3 * sqrt(1 + sigma2/f_bt) ;
Compression_failure2 = (f_k - sigma23) * 1/Forhold2*(1/2) ;
figure()
hold on
plot(sigma1, Friction,'--','Color',[0.4660 0.6740 0.1880])
plot(sigma2, Tension_failure,'--','Color',[0.9290 0.6940 0.1250])
plot(sigma3, Compression_failure,'--','Color',[0.4940 0.1840 0.5560])
plot(sigma1, Friction2)
plot(sigma2, Tension_failure,'Color',[0.6350 0.0780 0.1840])
plot(sigma23, Compression_failure2,'Color',[0.8500 0.3250 0.0980])
% Shade the area between [sigma1, Friction] and [sigma1, Friction2]
fill([sigma1, fliplr(sigma1)], [Friction, fliplr(Friction2)], [0.7 0.7 0.7], 'EdgeColor', 'none');
grid on;

채택된 답변

Mathieu NOE
Mathieu NOE 2024년 3월 1일
편집: Mathieu NOE 2024년 3월 1일
hello
you need to compute the intersections points - for that I am using the function in attachment (intersections.m , found that on the FEX page but may not be the only solution)
then use those points to redefine the area to fill
Forhold = 1/2 ;
Forhold2 = 54/228;
f_vk0 = 0.4 ; % Klæbningsbidrag [MPa]
mu_k = 0.65 ; % Friktionskoefficient
f_bt = 1.00 ; % Trækstyrke af sten [MPa]
f_k = 10.00 ; % Trykstyrke af sten [MPa]
sigma1 = -0.0:0.1:1.4 ;
sigma2 = 0.1:0.1:10 ;
sigma3 = 8.5:0.1:10 ;
sigma23 = 9.2:0.1:10 ;
Friction = (f_vk0 + mu_k * sigma1) / (1 + mu_k * 2 * Forhold) ;
Tension_failure = f_bt / 2.3 * sqrt(1 + sigma2/f_bt) ;
Compression_failure = (f_k - sigma3) * 1/Forhold*(1/2) ;
Friction2 = (f_vk0 + mu_k * sigma1) / (1 + mu_k * 2 * Forhold2) ;
Tension_failure = f_bt / 2.3 * sqrt(1 + sigma2/f_bt) ;
Compression_failure2 = (f_k - sigma23) * 1/Forhold2*(1/2) ;
figure()
hold on
plot(sigma1, Friction,'--','Color',[0.4660 0.6740 0.1880])
plot(sigma2, Tension_failure,'--','Color',[0.9290 0.6940 0.1250])
plot(sigma3, Compression_failure,'--','Color',[0.4940 0.1840 0.5560])
plot(sigma1, Friction2)
plot(sigma2, Tension_failure,'Color',[0.6350 0.0780 0.1840])
plot(sigma23, Compression_failure2,'Color',[0.8500 0.3250 0.0980])
% Shade the area between [sigma1, Friction] and [sigma1, Friction2]
[x0,y0,~,~] = intersections(sigma1,Friction,sigma2, Tension_failure);
ind = (sigma1<x0);
sigma1b = [sigma1(ind) x0]; % add x0 of true intersection point
Frictionp = [Friction(ind) y0]; % add y0 of true intersection point
[x1,y1,~,~] = intersections(sigma1,Friction2,sigma2, Tension_failure);
ind = (sigma1<x1);
sigma1c = [sigma1(ind) x1]; % add x1 of true intersection point
Friction2p = [Friction2(ind) y1]; % add y1 of true intersection point
% fill([sigma1, fliplr(sigma1)], [Friction, fliplr(Friction2)], [0.7 0.7 0.7], 'EdgeColor', 'none');
fill([sigma1b, fliplr(sigma1c)], [Frictionp, fliplr(Friction2p)], [0.7 0.7 0.7], 'EdgeColor', 'none');
grid on;

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Fluid Network Interfaces Library에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by