代码如下:
function Y1=myfun1(x)
Y1=4*[cos(x-pi/4)]^2;
function Y2=myfun2(x)
Y2=x/5+4;
function Y3=myfun3(x)
Y3=x*exp(5-x)
[X,Y]=fplot(@myfun,[-3,0]);
plot(X,Y,'r')
hold on
[X,Y]=fplot(@myfun2,[0,5]);
plot(X,Y,'g')
hold on
[X,Y]=fplot(@myfun3,[5,13]);
plot(X,Y)
hold on
用subplot吧
subplot(3,1,1)
plot(x,y1)
subplot(3,1,2)
plot(x,y2)
subplot(3,1,3)
plot(x,y3)
function Y1=myfun1(x)
Y1=4*[cos(x-pi/4)]^2;
function Y2=myfun2(x)
Y2=x/5+4;
function Y3=myfun3(x)
Y3=x*exp(5-x)
[X,Y]=fplot(@myfun,[-3,0]);
plot(X,Y,'r')
hold on
[X,Y]=fplot(@myfun2,[0,5]);
plot(X,Y,'g')
hold on
[X,Y]=fplot(@myfun3,[5,13]);
plot(X,Y)
hold on
有点麻烦,你可以借鉴一下