Can you please help to plot this figure in matlab?

1 Ansicht (letzte 30 Tage)
Hajem Daham
Hajem Daham am 13 Jun. 2018
Beantwortet: Basil Saeed am 13 Jun. 2018
  1 Kommentar
Jan
Jan am 13 Jun. 2018
What are your inputs? Which details matter? What have you tried so far?

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Basil Saeed
Basil Saeed am 13 Jun. 2018
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:

Weitere Antworten (0)

Kategorien

Mehr zu Graphics Object Programming finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by