Question
clc; close all; clear all; s1 = daq.getDevices; s2 = daq.createSession('ni'); addDigitalChannel(s2,'myDAQ1','port0/line4','OutputOnly') addDigitalChannel(s2,'myDAQ1','port0/line5','OutputOnly') % s2.Rate = 1000; start = [1 0]; outputSingleScan(s2,start) % for x=1:10
clc;
close all;
clear all;
s1 = daq.getDevices;
s2 = daq.createSession('ni');
addDigitalChannel(s2,'myDAQ1','port0/line4','OutputOnly')
addDigitalChannel(s2,'myDAQ1','port0/line5','OutputOnly')
% s2.Rate = 1000;
start = [1 0];
outputSingleScan(s2,start)
% for x=1:10
% s2 = daq.createSession('ni');
% s2.DurationInSeconds = 20;
% end
for x=1:2
s1 = daq.createSession('ni');
addAnalogInputChannel(s1,'myDAQ1','ai0','Voltage')
addAnalogInputChannel(s1,'myDAQ1','ai1','Voltage')
data= startForeground(s1);
filter = lowpass(data,3.5,1000);
calibrated_data = filter - [1.498,1.0845];
converting_voltage_to_acceleration = calibrated_data ;
top=mean(data(:,2)-calibrated_data(:,2))
bottom=mean(data(:,1)-calibrated_data(:,1))
diff= abs(bottom-top)* 24.857
subplot(2,1,1);
plot(converting_voltage_to_acceleration)
ylim([-10,10]);
xlim([1,1000])
legend('Deck','table');
title('Acceleration Vs S.Rate')
xlabel('S.Rate');
ylabel('Acceleration (cm/s^2)');
subplot(2,1,2);
deduct_ai1_ai0=abs(converting_voltage_to_acceleration(:,2)-converting_voltage_to_acceleration(:,1));
plot(deduct_ai1_ai0);
title('PI1=maximum(Adeck-Abase)')
xlabel('S.Rate');
ylabel('PI1');
xlim([0,1000])
drawnow
end
disp('PI1 is')
disp(deduct_ai1_ai0)
% addDigitalChannel(s2,'myDAQ1','port0/line4','OutputOnly')
% addDigitalChannel(s2,'myDAQ1','port0/line5','OutputOnly')
stop = [0 0];
outputSingleScan(s2,stop);
(explain this code please)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started