Filling area common to two inequalities?
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I am having two inequalities (one is explicit and another in implicit) and I want to fill the area common to these. I have drawn the corresponding equations in matlab but do not know how can I fill the common area. I am also uploading the image in which coloured their common area with help of paint. My code is:
clc;
clear all;
E11=0.041057; E12=-0.117734; E21=0.029952; E22=-0.042564;
A=[1 -E22/E11];
D0=E11*E22-E12*E21
x = linspace(-1, 7); % Row Vector
y1=max(A)*x ;
F=@(x,y) E11.^2*y.^2+E22.^2*x.^2+(2*x.*y.*E11.*E22-4.*x.*y.*D0);
plot(x, y1,'--b','linewidth',1.3)
hold on
fimplicit(F,[0 7 0 20],'--r','linewidth',1.3)
xlim([0,7])
ylim([0,20])
I want to fill the area in which y1>0 and F>0 which is filled with orange color in below image.
0 Commenti
Risposte (1)
KSSV
il 27 Gen 2023
clc;
clear all;
E11=0.041057;
E12=-0.117734;
E21=0.029952;
E22=-0.042564;
A=[1 -E22/E11];
D0=E11*E22-E12*E21 ;
x1 = linspace(-1, 7); % Row Vector
y1=max(A)*x1 ;
F=@(x,y) E11.^2*y.^2+E22.^2*x.^2+(2*x.*y.*E11.*E22-4.*x.*y.*D0);
[X,Y] = meshgrid(linspace(0,7),linspace(0,20)) ;
F = F(X,Y) ;
[c,h] = contour(X,Y,F,[0 0]) ;
c(:,1) =[] ;
x2 = c(1,:) ;
y2 = c(2,:) ;
plot(x1, y1,'--b','linewidth',1.3)
hold on
plot(x2,y2,'--r','linewidth',1.3)
xlim([0,7])
ylim([0,20])
Now you have the coordinates (x1,y1) and (x2,y2) in hand. You can pick the required coordinates you want and use polyarea
2 Commenti
Vedere anche
Categorie
Scopri di più su Matrix Indexing in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!