Author Topic: Solve this Equation - stuck up with small thing  (Read 457 times)

Offline sandy131

  • Newbie
  • *
  • Posts: 1
  • Matlab Forum
    • View Profile
Solve this Equation - stuck up with small thing
« on: February 04, 2010, 10:24:24 AM »

x = 1 -1 1 -1 1 -1 1

means x(1) = 1 and x(2) = -1 and so on tell x(7)

M(k) = sigma{x(i).*x(i+k)+x(i).*x(i+k-1).*x(i+k+1)}

for i = 0 to 6 - k

initially it should b solver by taking k=0 then k=1 and so on to k=7.

like wise we get m(0) m (1) and so on till m (7)

can any one do this ??
plz
thnx in advance!!


i have already solved part of it

  • clear;
    close all;
    x=[1 -1 1 -1 1 -1 1 zeros(1,8)];
    fork=1:7;
        for j=1:7;
            for i=1:7;
           r(j,i)=(x(1,i).*x(1,i+k))+(x(1,i).*x(1,i+k+1).*x(1,i+k-1));
            end;
        end;
        z(k,:)=sum(r,2);
    end;
    y=z(:,1)

    out put im getting is 5 -5 3 -3 1 -1 0

    but actual out put i should get is 6 5 -5 3 -3 1 -1

    first answer is missing and last extra 0 is coming

Matlab and SimuLink Development Forum

Solve this Equation - stuck up with small thing
« on: February 04, 2010, 10:24:24 AM »