that's only to manage data access to matlab from external components through the pc.amihomo said:I think the data aquisition toolbox in Matlab can help you.
% Audio spectrum display. To exit, close the figure.
%
Fs = 22050; % sample rate, hertz
T = 0.2; % sample duration, seconds
Hs = spectrum.welch('blackman',1024,20); % configure the transform
gca; % open the figure
while get(0,'CurrentFigure') % while figure still open
signal = wavrecord(T*Fs,Fs); % acquire some signal
psd(Hs, signal,'Fs',Fs); ylim([-160 0]); % transform and plot
pause(0.001); % allow figure to update
end
% Audio spectrum display. To exit, close the figure.
%
fs = 22050; % sample rate, hertz
N = 1024; % duration, samples
window = blackman(N); % weighting
window = window / mean(window); % normalize it
gca; % open the figure
while get(0,'CurrentFigure') % while figure still open
y = wavrecord(N, fs); % acquire some signal
h = fft(y .* window); % transform
plot(fs*(0:N/2)/N, 20*log10(max(2/N*abs(h(1:N/2+1)), 1e-10)));
ylim([-160 20]); xlabel('Hertz'); ylabel('dB');
drawnow; % allow figure to update
end
% Audio spectrum display. To exit, close the figure.
%
fs = 22050; % sample rate, hertz
N = 1024; % duration, samples
window = blackman(N); % weighting
window = window / mean(window); % normalize it
gca; % open the figure
while get(0,'CurrentFigure') % while figure still open
y = wavrecord(N, fs); % acquire some signal
h = fft(y .* window); % transform
plot(fs*(0:N/2)/N, 20*log10(max(2/N*abs(h(1:N/2+1)), 1e-10)));
ylim([-160 20]); xlabel('Hertz'); ylabel('dB');
drawnow; % allow figure to update
end
-------------------------------------------------------------------------------------
MATLAB Version 7.0.4.365 (R14) Service Pack 2
Java VM Version: Java 1.5.0 with Sun Microsystems Inc. Java HotSpot(TM) Client VM
-------------------------------------------------------------------------------------
MATLAB Version 7.0.4 (R14SP2)
Simulink Version 6.2 (R14SP2)
Communications Blockset Version 3.1 (R14SP2)
Communications Toolbox Version 3.1 (R14SP2)
Control System Toolbox Version 6.2 (R14SP2)
Fixed-Point Toolbox Version 1.2 (R14SP2)
Signal Processing Blockset Version 6.1 (R14SP2)
Signal Processing Toolbox Version 6.3 (R14SP2)
SimPowerSystems Version 4.0.1 (R14SP2)
Simulink Control Design Version 1.2 (R14SP2)
Simulink Fixed Point Version 5.1 (R14SP2)
Stateflow Version 6.2 (R14SP2)
% Audio spectrum display
fs = 22050; % sample rate, hertz
N = 1024; % duration, samples
y = wavrecord(N, fs); % acquire some signal
h = fft(y); % transform
plot(fs*(0:N/2)/N, 20*log10(max(2/N*abs(h(1:N/2+1)), 1e-10)));
ylim([-160 20]); xlabel('Hertz'); ylabel('dB');
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?