problem plotting random vector

hy, I have to make a hist(x,vet) where vet is a random vector of 1000 elements and vet is a vector of 10 elements. but the compuer tells me warning: hist: bin values not sorted on input how can i resolve? thanks

 채택된 답변

추가 답변 (1개)

daniele
daniele 2012년 1월 30일

0 개 추천

hy, thanks this solved the problem but now there is another on this is my code function gaussiana()
x=rand(1,1000)
vet=[0,0,0,0,0,0,0,0,0,0]
for k=1:1:1000,
if x(1,k)<0.1,
vet(1)=vet(1)+1;
else if x(1,k)<0.2,
vet(2)=vet(2)+1;
else if x(1,k)<0.3,
vet(3)=vet(3)+1;
else if x(1,k)<0.4,
vet(4)=vet(4)+1;
else if x(1,k)<0.5,
vet(5)=vet(5)+1;
else if x(1,k)<0.6,
vet(6)=vet(6)+1;
else if x(1,k)<0.7,
vet(7)=vet(7)+1;
else if x(1,k)<0.8,
vet(8)=vet(8)+1;
else if x(1,k)<0.9,
vet(9)=vet(9)+1;
else if x(1,k)<1,
vet(10)=vet(10)+1;
end;
end;
end;
end;
end;
end;
end;
end;
end;
end;
end;
vet
hist(x,sort(vet))
end function gaussiana()
i what an hist with on the y's the random numbers going between 0 and 1, and on the x's vet, the x's are ok, but on the y's there are just numbers between and 1000. how can i solve this problem?

카테고리

도움말 센터File Exchange에서 Numerical Integration and Differential Equations에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by