Info

此问题已关闭。 请重新打开它进行编辑或回答。

to build a histogram

3 次查看(过去 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