早教吧 育儿知识 作业答案 考试题库 百科 知识分享

matlab执行下列命令后出错如下,请问该怎么改t = 0:pi/20:2*pi;hline1 = plot(t,sin(t),'k');%Next,add a shadow by offsetting the x-coordinates.Make the shadow line light gray and wider than the %%default LineWidth:hline2 = line(t+.06,sin(t

题目详情
matlab执行下列命令后出错如下,请问该怎么改
t = 0:pi/20:2*pi;hline1 = plot(t,sin(t),'k');
%Next,add a shadow by offsetting the x-coordinates.Make the shadow line
light gray and wider than the %%default LineWidth:
hline2 = line(t+.06,sin(t),'LineWidth',4,'Color',[.8 .8 .8]);
%Finally,pop the first line to the front:
set(gca,'Children',[hline1 hline2])
Error using setChildren may only be set to a permutation of itself
▼优质解答
答案和解析

除了有一行应该是注释,其它没问题啊

t = 0:pi/20:2*pi;hline1 = plot(t,sin(t),'k');
% Next, add a shadow by offsetting the x-coordinates. Make the shadow line 
% light gray and wider than the %%default LineWidth:
hline2 = line(t+.06,sin(t),'LineWidth',4,'Color',[.8 .8 .8]);
%Finally, pop the first line to the front:
set(gca,'Children',[hline1 hline2])