Info

This question is closed. Reopen it to edit or answer.

to build a histogram

1 view (last 30 days)
Daniel Fonsêca
Daniel Fonsêca on 28 Jun 2018
Closed: MATLAB Answer Bot on 20 Aug 2021
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

Answers (0)

This question is closed.

Community Treasure Hunt

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

Start Hunting!