刚学matlab,clear,clcf0=1;%方波的频率t=0:.01:10;f=@(t) square(2*pi*f0*t); square(2*pi*f0*t); figure,plot(t,square(2*pi*f0*t)),axis([0,10,-2,2]),title('原函数')n=length(t)for i=1:nF(i)=quad(f,0,t(i));endfigure,plot(t,F),title('积分后');
来源:学生作业帮助网 编辑:作业帮 时间:2024/08/27 01:37:57
刚学matlab,clear,clcf0=1;%方波的频率t=0:.01:10;f=@(t) square(2*pi*f0*t); square(2*pi*f0*t); figure,plot(t,square(2*pi*f0*t)),axis([0,10,-2,2]),title('原函数')n=length(t)for i=1:nF(i)=quad(f,0,t(i));endfigure,plot(t,F),title('积分后');
刚学matlab,
clear,clc
f0=1;%方波的频率
t=0:.01:10;
f=@(t) square(2*pi*f0*t);
square(2*pi*f0*t);
figure,plot(t,square(2*pi*f0*t)),axis([0,10,-2,2]),title('原函数')
n=length(t)
for i=1:n
F(i)=quad(f,0,t(i));
end
figure,plot(t,F),title('积分后');
求人一句句解答~
刚学matlab,clear,clcf0=1;%方波的频率t=0:.01:10;f=@(t) square(2*pi*f0*t); square(2*pi*f0*t); figure,plot(t,square(2*pi*f0*t)),axis([0,10,-2,2]),title('原函数')n=length(t)for i=1:nF(i)=quad(f,0,t(i));endfigure,plot(t,F),title('积分后');
clear,clc%clear清除workspace中的变量,clc清除command窗口中的命令.
f0=1;%方波的频率
t=0:.01:10;%区间[0,10]的集合,步长0.01
f=@(t) square(2*pi*f0*t);
square(2*pi*f0*t);
figure,plot(t,square(2*pi*f0*t)),axis([0,10,-2,2]),title('原函数')%figure呈现一个空白作图窗口,plot作图函数,axis控制坐标轴,title图像标题;
n=length(t)%集合t的元素长度,在这里是个数.
for i=1:n%此句至end之间是一个for循环;
F(i)=quad(f,0,t(i));%quad求定积分函数;
end
figure,plot(t,F),title('积分后');