2条回答 默认 最新
- joel_1993 2021-10-10 01:02关注
你好,代码仅供参考
clc;clear % (1) 第一题 f1 = @(x) (x.^3+6*x.^2+3)./(2*x.^2+2*x+7); f2 = @(x) log(x+8).*sin(x); f3 = @(x) sin(x.^2); figure(1) subplot(1,2,1) t = -4:0.01:-1; plot(t,f1(t),'r-'); hold on t = -1:0.01:1; plot(t,f2(t),'g-'); hold on t = 1:0.01:4; plot(t, f3(t),'b-'); plot([-1, 1],[f1(-1),f2(1)],'o')%标记分段开区间 title('分段函数') legend('分段1','分段2','分段3','开区间圆圈') %(2)第二题 subplot(1,2,2) x = @(t) 2*cos(t).^4; y = @(t) 2*sin(t).^4; t = linspace(0,2*pi,101); plot(x(t),y(t),'--','color',[255,128,0]/255) hold on x = @(t) sin(t); y = @(t) sin(2*t); plot(x(t),y(t),'*','color',[255,192,203]/255) title('参数方程') legend('方程1','方程2')
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报