Info

この質問は閉じられています。 編集または回答するには再度開いてください。

to build a histogram

1 回表示 (過去 30 日間)
Daniel Fonsêca
Daniel Fonsêca 2018 年 6 月 28 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
Hi everybody. I need a help. I'm trying to make a histogram which the average value must be zero. So, I'm not getting a histogram which has in axis-x both values positives and negatives.
This is the function which I'm using:
function freqDT = htgDT(da,det)
% Chamamos a função dife para realizar a diferença de tempo. Ela retorna uma matriz com as diferenaças
DF=dife(da,det);
b=size(DF);
MDT=zeros(2001,b(1,2)); %A quantidade de diferenças corresponderá a quantidade de colunas de DF
for y =1:b(1,2) %y varia conforme a quantidade de diferenças
for x = 1:b(1,1)
c = DF(x,y);
if c == 0
MDT(1,y)=MDT(1,y) + 1;
end
if c>0 && c<1000
MDT(c+1,y)=MDT(c+1,y) + 1;
end
%%%%%%%%%%%%%%the probleme is here%%%%%%%%%%%%
if c<0 && abs(c)<1000
%x
%M=abs(c)+1000
MDT(abs(c)+1000,y)= MDT(abs(c)+1000,y) + 1;
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
end
end
freqDT = MDT;
end

回答 (0 件)

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by