Created
June 16, 2011 21:46
-
-
Save zaman/1030372 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%Simple analog diaplay | |
figure(2) | |
%define the input | |
adaptor = 'winsound'; | |
id = 0; | |
chan = 1; | |
% Analog input object Configuration. | |
% Create an analog input object with one channel. | |
ai = analoginput(adaptor, id); | |
ch = addchannel(ai, chan); | |
% Configure the analog input rate. | |
set(ai, 'SampleRate', 44100); | |
% Configure the analog input object to trigger manually. | |
set(ai, 'SamplesPerTrigger', 441); % 1/100 second | |
set(ai, 'TriggerRepeat', 1); | |
set(ai, 'TriggerType', 'manual'); | |
% Object Execution. | |
% Start the analog input object. | |
for i=1:50 | |
%start data collection and trigger it | |
start(ai); | |
trigger(ai); | |
% Obtain the available time and data. | |
[data,time] = getdata(ai, ai.SamplesPerTrigger); | |
stop(ai) | |
%plot the data and set axes | |
plot(time,data,'w'); | |
set(gca, 'XLim', [0 get(ai,'SamplesPerTrigger')/44100]); | |
set(gca, 'YLim', [-1 1]); | |
set(gca, 'color', [.1 .4 .2]); | |
grid on | |
% Label the plot. | |
xlabel('Time (sec)'); | |
ylabel('Winsound.0 (Volts)'); | |
drawnow | |
end | |
delete(ai); | |
clf; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@semihozkoroglu & @seddi bu kodu inceleyelim basit bir AnalogInput alımı gerçeklenmiş.