help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: help please


From: Doug Stewart
Subject: Re: help please
Date: Wed, 29 Jul 2015 22:59:22 -0400



On Wed, Jul 29, 2015 at 5:54 PM, mrtgc <address@hidden> wrote:
https://www.dropbox.com/s/4mt3jyt0bkvslnr/prueba.224?dl=0

In this direction you can see the file of which I speak , not because when I
upload photos to the page are not , so I will pass the link is easier .
And this is the error:
>> prueba2
warning: fopen: file found in load path
f = fopen('prueba.224');
d = textscan(f,'%*d %*s %*d %*d %*d %d %*d %*d %*d %d %f ');
fclose(f);
elv=d(1);
dif=d(2);
t=d(3);
i=1;
j=1;
ii=length(t);
        while i<ii
            Eq(i)=find(t==t(i));
            L=length(Eq);
            pesos(j)=(sin(elv(Eq(i))))^2;
            x1(j)=sum(dif(Eq(i))*pesos(j))/sum(pesos);
            i=i+L;
            i=i+L;
            j=j+1;
        end

everything works fine until the length, in the next line I do not get what I
want . That is taking the corresponding rows where t satisfies equality take
up columns defined as ELV and dif, to average the data:

adding the product of the square sins of ELV and dif, and divide that amount
enters the sum of squares of ELV sins




this runs but I don't know if it is what you want!!!!

f = fopen('prueba.224');
d = textscan(f,'%*d %*s %*d %*d %*d %d %*d %*d %*d %d %f ');
fclose(f);
elv=cell2mat(d(1));
dif=cell2mat(d(2));
t=cell2mat(d(3));
i=1;
j=1;
ii=length(t)
        while i<ii
            Eq=find(t==t(i))
            L=length(Eq);
            pesos= (sin(elv(Eq))).^2
            x1(j)=sum(dif(Eq).*pesos(:))./sum(pesos);
            i=i+L;
            i=i+L;
            j=j+1;
        end
        
x1        





reply via email to

[Prev in Thread] Current Thread [Next in Thread]