matlab - Displaying entire vector shows only zeros but displaying a any single element shows a correct nonzero number -


i have vector defined x=(1:1000) , vector y of same size lot of different numbers those:

-0.0019 -0.0018 -0.0018 -0.0019 -0.0019 -0.0020 

i have copied values of y x while statement , when put in console x(1) result -0.0019, y(1) , on rest of indexes when put in console x shows list this:

-0.0000 -0.0000 -0.0000 -0.0000 

in workspace, value of both vectors <1000x1 double> , when plot 2 vectors graph of y alright graph of x line of zeros

this code:

%grabar audio en un archivo fs = 200000; y = wavrecord(1*fs, fs, 1); %10 segundos wavwrite(y,fs,'cancion.wav');    %leer el archivo y graficar las ondas [wave,fs] = wavread('cancion.wav');   t = 0:1/fs:(length(wave)-1)/fs;  sound(wave,fs) plot(t,wave)  fs2 = 1000; j=1; i=1; xa=(1:fs2); while j<fs2     xa(j) = wave(i);     i=i+fs/fs2;     j=j+1; end  intervalo = 0:1/fs2:1-(1/fs2); xa=xa'; figure(2) plot(intervalo,xa);  %display(length(wave)) 

anyone can tell me happening?

in line 17, use: xa=zeros(1,fs2);


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -