error in fourie script

조회 수: 2 (최근 30일)
f4r3in
f4r3in 2017년 2월 15일
hi I use MatLab 2016a and write this script but I receive this error. how should I fix it:
g=@(x)1.*(x>0)+(-1).*(x<0)
a_0=(1/pi)*quad(g,-pi,pi);
for n=1:10
a_n(n)=(1/pi)*quad(g*cos(n*x),-pi,pi);
b_n(n)=(1/pi)*quad(g*sin(n*x),-pi,pi);
end
a_n
b_n
f=a_0;
for n=1:10
f=f+a_n(n)*cos(n*x)+b_n(n)*sin(n*x);
end
ezplot(x,f)

답변 (0개)

카테고리

Help CenterFile Exchange에서 Application Deployment에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by