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 matcherror: evaluating if command near line 59, column 3error: called from `__plt2vv__' in file `C:\Users\P\Desktop\scuola\calcolo\qtoctave-0.6.8\Octave\share\octave\2.9.15\m\plot\__plt2vv__.m'error: evaluating assignment expression near line 59, column 14error: evaluating if command near line 58, column 5error: evaluating if command near line 51, column 3error: called from `__plt2__' in file `C:\Users\P\Desktop\scuola\calcolo\qtoctave-0.6.8\Octave\share\octave\2.9.15\m\plot\__plt2__.m'error: evaluating assignment expression near line 76, column 10error: evaluating if command near line 75, column 4error: evaluating if command near line 55, column 2error: evaluating if command near line 54, column 7error: evaluating while command near line 41, column 5error: evaluating if command near line 28, column 3error: called from `__plt__' in file `C:\Users\P\Desktop\scuola\calcolo\qtoctave-0.6.8\Octave\share\octave\2.9.15\m\plot\__plt__.m'error: evaluating assignment expression near line 196, column 9error: evaluating if command near line 181, column 3error: 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\qtoctave-0.6.8\gaussiana.m'gnuplot> plot "-"; ^ line 1: Bad data on line 1
can some one help me?
thanks
Best Answer