Initial commit
This commit is contained in:
22
c_5_5_5.m
Normal file
22
c_5_5_5.m
Normal file
@@ -0,0 +1,22 @@
|
||||
x=linspace(0,10,100);
|
||||
y=[];
|
||||
for x0=x
|
||||
if x0>=8
|
||||
y=[y,1];
|
||||
elseif x0>=6
|
||||
y=[y,5-x0/2];
|
||||
elseif x0>=4
|
||||
y=[y,2];
|
||||
elseif x0>=0
|
||||
y=[y,sqrt(x0)];
|
||||
end
|
||||
end
|
||||
plot(x,y);
|
||||
axis([0,10,0,2.5]);
|
||||
title('分段函数曲线');
|
||||
xlabel('Variable X');
|
||||
ylabel('Variable Y');
|
||||
text(2,1.3,'y=x^{1/2}');
|
||||
text(4.5,1.9,'y=2');
|
||||
text(7.3,1.5,'t=5-x/2');
|
||||
text(8.5,0.9,'y=1');
|
||||
Reference in New Issue
Block a user