Can you please help to plot this figure in matlab?

조회 수: 1 (최근 30일)
Hajem Daham
Hajem Daham 2018년 6월 13일
답변: Basil Saeed 2018년 6월 13일
  댓글 수: 1
Jan
Jan 2018년 6월 13일
What are your inputs? Which details matter? What have you tried so far?

댓글을 달려면 로그인하십시오.

채택된 답변

Basil Saeed
Basil Saeed 2018년 6월 13일
You can plot some of the features on the graph as follows:
%Define the functions
f1 = @(x) 16*x + 2;
f2 = @(x) -4*x + 8;
f3 = @(x) -14*x + 12 ;
%Plot the functions specifying the type of line and color, and horizontal
%axis limit
fplot(f1, [-0,1], 'k');
hold on;
grid on;
fplot(f2, [-0,1], '--k');
fplot(f3, [-0,1],':k');
%Specify the vertical axis limit
ylim([0,16]);
%Shade the desired area with some color (specified as RGB vector)
x1 = 0:0.01:0.3;
x2 = 0.3:0.01:0.4;
x3 = 0.4:0.01:1;
area(x1,f1(x1),'FaceColor', [0 0.75 0.75]);
area(x2,f2(x2),'FaceColor', [0 0.75 0.75]);
area(x3,f3(x3),'FaceColor', [0 0.75 0.75]);
%plot the points with the desired labels
plot(0,2,'k.', 'MarkerSize', 30);
text(0.01, 2, 'A', 'FontSize', 15);
%
plot(0.3,6.8,'k.', 'MarkerSize', 30);
text(0.31, 6.8, 'B', 'FontSize', 15);
%
plot(0.4,6.4,'k.', 'MarkerSize', 30);
text(0.41, 6.4, 'C', 'FontSize', 15);
%
plot(0.4,6.4,'k.', 'MarkerSize', 30);
text(0.41, 6.4, 'C', 'FontSize', 15);
%
plot(12/14, 0, 'k.', 'MarkerSize', 30);
text(12/14 + 0.01, 0.2, 'D', 'FontSize', 15);
%
plot(0, 0, 'k.', 'MarkerSize', 30);
text(0.01, 0.2, 'E', 'FontSize', 15);
hold off;
This produces the following graph:

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Graphics Object Programming에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by