MATLAB: Problem plotting with octave

octave

hello everybody
I have to plot a graphic with in the y's my vector called x of 100 elements, and in the x's my other vector of 10 elements. the computer tells me that they have this vectors mus be he same length but I don't think so. this is he code
function gaussiana()
x=rand(1,100)
vet=[0,0,0,0,0,0,0,0,0,0]
for k=1:1:100,
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
plot(x,vet)
end function gaussiana()
and this is the error it gives me
error: __plt2vv__: vector lengths must match
error: evaluating if command near line 59, column 3
error: called from `__plt2vv__' in file `C:\Users\P\Desktop\scuola\calcolo\qtoc
tave-0.6.8\Octave\share\octave\2.9.15\m\plot\__plt2vv__.m'
error: evaluating assignment expression near line 59, column 14
error: evaluating if command near line 58, column 5
error: evaluating if command near line 51, column 3
error: called from `__plt2__' in file `C:\Users\P\Desktop\scuola\calcolo\qtocta
ve-0.6.8\Octave\share\octave\2.9.15\m\plot\__plt2__.m'
error: evaluating assignment expression near line 76, column 10
error: evaluating if command near line 75, column 4
error: evaluating if command near line 55, column 2
error: evaluating if command near line 54, column 7
error: evaluating while command near line 41, column 5
error: evaluating if command near line 28, column 3
error: called from `__plt__' in file `C:\Users\P\Desktop\scuola\calcolo\qtoctav
e-0.6.8\Octave\share\octave\2.9.15\m\plot\__plt__.m'
error: evaluating assignment expression near line 196, column 9
error: evaluating if command near line 181, column 3
error: called from `plot' in file `C:\Users\P\Desktop\scuola\calcolo\qtoctave-0
.6.8\Octave\share\octave\2.9.15\m\plot\plot.m'
error: called from `gaussiana' in file `C:\Users\P\Desktop\scuola\calcolo\qtoct
ave-0.6.8\gaussiana.m'
gnuplot> plot "-";
^
line 1: Bad data on line 1
can some one help me?
thanks

Best Answer

You are trying to plot a vector of length 100, x, against a vector of length 10, vet.
By the way, have you considered using histc() ?