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:
  1 件のコメント
Hajem Daham
Hajem Daham 2018 年 6 月 13 日

Thanks, Basil Saeed

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGraphics Object Programming についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by