Error using normcdf function
11 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Oliver Lestrange
le 22 Août 2020
Réponse apportée : Star Strider
le 22 Août 2020
Hi,
I am trying to make a CDF. I am using the array eixoXX.
% --- Executes on button press in densityButton.
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)
handles = rmfield( handles, 'Antena' );
handles = rmfield( handles, 'nAntena' );
handles = rmfield( handles, 'Movel' );
handles = rmfield( handles, 'Rheight' );
handles = rmfield( handles, 'Rwidth' );
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);
eixoXX = minPower:.1:maxPower;
size = length(Prx);
figure
plot(eixoXX, cdf('Normal',eixoXX, mean(Prx),std(Prx)))
grid on;
I always get the error:
Error using normcdf>localnormcdf (line 79)
Non-scalar arguments must match in size.
I don't know how de cdf function really works but it seems that is supposed to have a mu and sigma, that's why I have an mean and std.
Can someone explain me what I am doing wrong?
Thanks!
0 commentaires
Réponse acceptée
Star Strider
le 22 Août 2020
I am guessing that ‘Prx’ is a matrix, not a vector, and apparently ‘eixoXX’ is a vector. In that instance, the mean and std will be vectors. This is not compatible with the Input Arguments requirements of the cdf function.
See if calculating the mean and standard deviation as:
mean(Prx(:))
std(Prx(:))
will produce the result you want.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Structures dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!