How do I find the phase of any point in the graph below
2 views (last 30 days)
Show older comments
Owuraku Amankwah
on 17 Jul 2021
Commented: Owuraku Amankwah
on 18 Jul 2021
x=[0:10:91]; str={'Phase 1','Phase 2'}; y=[0.01*(x.^2)]; xt=[30 70]; yt=[60 20]; plot(x,y,'k','LineWidth',5),xlabel('Composition'),ylabel('Temperature');
3 Comments
Accepted Answer
DGM
on 17 Jul 2021
Edited: DGM
on 17 Jul 2021
Considering that there's only one boundary of interest, it's fairly simple.
x=0:10:91;
y=0.01*x.^2;
xt=[30 70];
yt=[60 20];
str={'Phase 1','Phase 2'};
plot(x,y,'k','LineWidth',5); hold on;
plot(xt,yt,'*')
xlabel('Composition');
ylabel('Temperature');
isabovecurve = yt>(0.01*xt.^2)
That will give you a logical vector describing where each point is WRT the boundary curve.
If you don't like repeating the expression, you could do something like:
x=0:10:91;
fy = @(xx) 0.01*xx.^2; % define y as a function
y=fy(x); % and just evaluate it
xt=[30 70];
yt=[60 20];
% do all the plotting stuff
isabovecurve = yt>fy(xt) % and evaluate it again with different points
If your problem is more complicated than this example (i.e. more boundaries), then this probably isn't going to help much.
More Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!