Azzera filtri
Azzera filtri

Why bar function is so slow?

1 visualizzazione (ultimi 30 giorni)
Oliver Lestrange
Oliver Lestrange il 20 Ago 2020
Modificato: Oliver Lestrange il 20 Ago 2020
Hi,
I am using the following code.
function densityButton_Callback(hObject, eventdata, handles)
% hObject handle to densityButton (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
i = handles.map.img(:,:,1)==255 & handles.map.img(:,:,2)==255 & ...
handles.map.img(:,:,3)==255;
Prx = handles.maxPrxArray;%(i);
minPower = round(handles.minPrx);
maxPower = round(handles.maxPrx);
% Eixo dos xx - Histograma
eixoXX = minPower:maxPower;
size = length(Prx);
% Histograma
pdfGra = 100*hist(Prx, eixoXX)/size;
figure
axis([(minPower-10) (maxPower+10) 0 100])
bar(eixoXX,pdfGra);
xlabel('Potência [dBm]')
ylabel('Probabilidade [%]')
title('Função de Densidade de Probabilidade');
grid on
cdfGra = cumsum(pdfGra);
figure
axis([(minPower-10) (maxPower+10) 0 100])
bar(eixoXX,cdfGra);
xlabel('Potência [dBm]')
ylabel('Probabilidade [%]')
title('Função de Distribuição de Probabilidade Cumulativa');
grid on
This code is extremely slow. I made debug and I find out that is the bar function that make it so slow.
Is there something that I can do to make it faster?
I am using the version R2016a.

Risposte (0)

Categorie

Scopri di più su Data Distribution Plots in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by