How to fill the region formed by four lines?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Tmat
el 30 de Nov. de 2022
Comentada: Tmat
el 30 de Nov. de 2022
I want to fill the parallelogram region formed by four straight lines. I have tried the following codes:
beta11_um1 = @(delta11) 4.1797+0.396*delta11;
beta11_lm1 = @(delta11) 0.4090+0.396*delta11;
beta11_up1= @(delta11) 3.8058-0.475*delta11;
beta11_lp1= @(delta11) 1.916-0.475*delta11;
delta11= -10:0.1:10;
pgon1 = polyshape(delta11,beta11_um1(delta11));
pgon2 = polyshape(delta11,beta11_lm1(delta11));
pgon3= polyshape(delta11,beta11_up1(delta11));
pgon4= polyshape(delta11,beta11_lp1(delta11));
figure
plot(delta11,beta11_um1(delta11),delta11,beta11_lm1(delta11),delta11,beta11_up1(delta11),delta11,beta11_lp1(delta11));
hold on
plot(intersect(pgon1,pgon2,pgon3,pgon4),'EdgeColor','none','FaceColor','m')
The output of the codes do have the four lines plotted, but the parallelogram region in the middle is not filled. How could I fix this? Thanks!
0 comentarios
Respuesta aceptada
David Hill
el 30 de Nov. de 2022
Editada: David Hill
el 30 de Nov. de 2022
beta11_um1 = @(delta11) 4.1797+0.396*delta11;
beta11_lm1 = @(delta11) 0.4090+0.396*delta11;
beta11_up1= @(delta11) 3.8058-0.475*delta11;
beta11_lp1= @(delta11) 1.916-0.475*delta11;
delta11= -10:0.1:10;
figure
plot(delta11,beta11_um1(delta11),delta11,beta11_lm1(delta11),delta11,beta11_up1(delta11),delta11,beta11_lp1(delta11));
x=[-2.598967,1.730195,3.899885,-.429277];
y=[beta11_lp1(x(1)),beta11_lp1(x(2)),beta11_up1(x(3)),beta11_up1(x(4))];
pgon=polyshape(x,y);
hold on;
plot(pgon,'EdgeColor','none','FaceColor','m')
3 comentarios
David Hill
el 30 de Nov. de 2022
beta11_um1 = @(delta11) 4.1797+0.396*delta11;
beta11_lm1 = @(delta11) 0.4090+0.396*delta11;
beta11_up1= @(delta11) 3.8058-0.475*delta11;
beta11_lp1= @(delta11) 1.916-0.475*delta11;
x=[fzero(@(x)beta11_um1(x)-beta11_lp1(x),1),...
fzero(@(x)beta11_lm1(x)-beta11_lp1(x),1),...
fzero(@(x)beta11_lm1(x)-beta11_up1(x),1),...
fzero(@(x)beta11_um1(x)-beta11_up1(x),1)]
Más respuestas (0)
Ver también
Categorías
Más información sobre Line Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!