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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!