y|[gۑiTj𓚗z

 

1D

vO

x=-10:0.01:10;

y1=zeros(size(x));

y2=zeros(size(x));

n1=3;

n2=10;

 

a=1;

for i=1:n1

  y1=y1+cos(a*x)/a^2;

  a=a+2;

end

y1=y1*2/pi;

 

a=1;

for i=1:n2

  y2=y2+cos(a*x)/a^2;

  a=a+2;

end

y2=y2*2/pi;

 

plot(x,y1,x,y2)

legend('n=3','n=10')

grid('on')

s

 

 

2D

vO

x=[-10 -8 -4 -2 -1 0 3 5 7 9];

y=[95 60 15 3 1 -1 12 30 45 78];

p=polyfit(x,y,2)

x1=-10:0.1:10;

y1=polyval(p,x1);

plot(x,y,'o',x1,y1)

legend('data','line')

grid('on')

p =

    0.94655    0.13892    0.77944

 

3D

vO

f=[2 3 2 1];

g=[1 4 2];

while(1)

  [q,r]=deconv(f,g);

  if norm(r)<1e-10

    break;

  end

  while(abs(r(1))<1e-10)

      r(1)=[];

  end

  f=g;

  g=r;

end

gcd=g/g(1)

gcd =

     1