Math Help - MATLAB: Plotting MATRIX?

1. MATLAB: Plotting MATRIX?

How would I plot Q in this? I keep getting an error.

Code:
[x,fs,k]=wavread('sound0.wav');
x = x(1:length(x),1);
N=length(x);
time=[0:1:N-1]*1/fs;

q=x1+x2+x3+x4;
%sound(q,fs);
plot(time,q);

2. Originally Posted by synnexster
How would I plot Q in this? I keep getting an error.

Code:
[x,fs,k]=wavread('sound0.wav');
x = x(1:length(x),1);
N=length(x);
time=[0:1:N-1]*1/fs;

q=x1+x2+x3+x4;
%sound(q,fs);
plot(time,q);
Why are dead and x of the same length?

Also if you want help finding the error in future tell us what the error message is, and at what point in the script that it occurs.

.

3. It happens at the plot(time,q); line.

Here is the error:

??? Error using ==> plot
Vectors must be the same lengths.

dead adds 1 second of silence, and i've added echos: x1,x2,x3,x4. I just want to plot it.

4. Originally Posted by synnexster
It happens at the plot(time,q); line.

Here is the error:

??? Error using ==> plot
Vectors must be the same lengths.

dead adds 1 second of silence, and i've added echos: x1,x2,x3,x4. I just want to plot it.
You have not extended time in the same way you have extended q.

Learn to use the debugger and single step through the script querying the size of the arrays as you go.

.