- #1
Ephant
- 147
- 2
Hi, the following plots the waveforms and the FFT of a signal (one channel only):
It plots the column of one channel. In the following, how do you make the above plot channel 1 only of the following which seems to be in rows?
<Moderator's note: post edited to add CODE tags.>
Matlab:
signal = data; %assuming data was loaded first
Fs = 4800; % Sampling frequency
T = 1/Fs; % Sampling period
L = size(signal, 1); % Length of signal
t = (0:L-1)*T; % Time vector
X = double(signal);
plot(1000*t,X);
title('signal');
xlabel('t (milliseconds)');
ylabel('X(t)');
X = X - mean(X);
Y = fft(X);
P2 = abs(Y/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
f = Fs/L*(0:(L/2));
plot(f,P1,'LineWidth',0.5);
title('Single-Sided Amplitude Spectrum of X(t)');
xlabel('f (Hz)');
ylabel('|P1(f)|');
It plots the column of one channel. In the following, how do you make the above plot channel 1 only of the following which seems to be in rows?
Matlab:
Channels=17;
FileName='test.bin';
fid=fopen(FileName,'rb');
data=fread(fid,[Channels inf],'float32');
fclose(fid);