Find your both the programs below:
a)
prompt='What is the grade from 0 to 100?';
x=input(prompt)
if x>60
if x>70
if x>80
if x>90
if x>0
end
if x>=90
disp('A')
end
end
if x>=80 && x<90
disp('B')
end
end
if x>=70 && x<80
disp('C')
end
end
if x>=60 && x<70
disp('D')
end
end
if x<60
disp('F')
end
b)
clear all
mypi = raspi
mypi.AvailableI2CBuses;
mypi.I2CBusSpeed;
scanI2CBus(mypi,'i2c-1');
BMP180 = i2cdev(mypi,'i2c-1','0x77');
AC1m=int16(readRegister(BMP180, hex2dec('AA'),'int8'));
AC1l=int16(readRegister(BMP180, hex2dec('AB'),'int8'));
AC1 = int32(typecast((bitshift(AC1m,8)+ AC1l),'int16'));
AC2m=int16(readRegister(BMP180, hex2dec('AC'),'int8'));
AC2l=int16(readRegister(BMP180, hex2dec('AD'),'int8'));
AC2 = int32(typecast((bitshift(AC2m,8)+ AC2l),'int16'));
AC3m=int16(readRegister(BMP180, hex2dec('AE'),'int8'));
AC3l=int16(readRegister(BMP180, hex2dec('AF'),'int8'));
AC3 = int32((bitshift(AC3m,8)+ AC3l));
AC4m=int16(readRegister(BMP180, hex2dec('B0'),'int8'));
AC4l=int16(readRegister(BMP180, hex2dec('B1'),'int8'));
AC4 = int32(typecast((bitshift(AC4m,8)+ AC4l),'uint16'));
% AC5=int16(readRegister(BMP180, hex2dec('B2'),'uint16'));
AC5m=int16(readRegister(BMP180, hex2dec('B2'),'int8'));
AC5l=int16(readRegister(BMP180, hex2dec('B3'),'int8'));
AC5 = int32(typecast((bitshift(AC5m,8)+ AC5l),'uint16'));
% AC6=int16(readRegister(BMP180, hex2dec('B4'),'uint16'));
AC6m=int16(readRegister(BMP180, hex2dec('B4'),'int8'));
AC6l=int16(readRegister(BMP180, hex2dec('B5'),'int8'));
AC6 = int32(typecast(bitshift(AC6m,8)+ AC6l,'uint16'));
% B1=int16(readRegister(BMP180, hex2dec('B6'),'int16'));
B1m=int16(readRegister(BMP180, hex2dec('B6'),'int8'));
B1l=int16(readRegister(BMP180, hex2dec('B7'),'int8'));
B1 = int32((bitshift(B1m,8)+ B1l));
% B2=int16(readRegister(BMP180, hex2dec('B8'),'int16'));
B2m=int16(readRegister(BMP180, hex2dec('B8'),'int8'));
B2l=int16(readRegister(BMP180, hex2dec('B9'),'int8'));
B2 = int32((bitshift(B2m,8)+ B2l));
% MB=int16(readRegister(BMP180, hex2dec('BA'),'int16'));
MBm=int16(readRegister(BMP180, hex2dec('Ba'),'int8'));
MBl=int16(readRegister(BMP180, hex2dec('BB'),'int8'));
MB = int32((bitshift(MBm,8)+ MBl));
% MC=int16(readRegister(BMP180, hex2dec('BC'),'int16'));
MCm=int16(readRegister(BMP180, hex2dec('BC'),'int8'));
MCl=int16(readRegister(BMP180, hex2dec('BD'),'int8'));
MC = int32((bitshift(MCm,8)+ MCl));
% MD=int16(readRegister(BMP180, hex2dec('BE'),'int16'));
MDm=int16(readRegister(BMP180, hex2dec('BE'),'int8'));
MDl=int16(readRegister(BMP180, hex2dec('BF'),'int8'));
MD = int32((bitshift(MDm,8)+ MDl));
if readRegister(BMP180, hex2dec('D0'),'int8') ~=hex2dec('55')
error('Sonething wrong with temperature sensor')
end
writeRegister(BMP180, hex2dec('F4'), hex2dec('2E'),'int8')
pause(4.5E-3)
pause(5*60)
MSBt=int16(readRegister(BMP180, hex2dec('F6'),'int8'));
LSBt=int16(readRegister(BMP180, hex2dec('F7'),'int8'));
UT=int32((bitshift(MSBt, 8)) + (LSBt));
% UT = int32(27898);
% AC1 = int16(408)
% AC2 = int16(-72)
% AC3 = int16(-14383)
% AC4 = int16(32741)
% AC5 = int16(32757)
% AC6 = int16(23153)
% B1 = int16(6190)
% B2 = int16(4)
% MB = int16(-32768)
% MC = int16(-8711)
% MD = int16(2868)
%
%
X1=int32((UT-int32(AC6))*int32(AC5)/(2^15));
X2=int32(int32(MC)*2^11/((X1+int32(MD))));
B5=double(X1+X2);
T=(B5+8)/(2^4)*0.1
3. a) Write a Matlab program to define student grade program and student number with (10 Marks) statement logic b) Write a Matlab program for sensor selection of temperature, pressure, flow sensor...
Write a Python Program Display the grades: Input: Enter the marks of the student Condition: Grade A: Marks greater than 90 Grade B: Marks range from 81 to 90 Grade C: Marks range from 65 to 80 Fail: less than 65 Display the output. Example: Input: 95 Display: “student got Grade A” Input: 80 Display: “student got Grade C” Input: 64 Display: “student failed” Hint: Use else if (elif and logical operators)
MATLAB PROGRAM FOR THE FOLLOWING PROBLEM Using Matlab write a program that will plot the pressure signal, the perceived pressure signal, the resistance and the output voltage as functions of time, for Problem 1.30 in the textbook. (B) Using Matlab show a plot with the output voltage range if we happen to know that the transfer function (gain) has an uncertainty of 15% and the time constant has an uncertainty of 10%. (Note: the solution of the problem is provided...
ONLY REQUIRE C Problem statement: You are to write a program that manages student marks for a class. Student marks are stored as a 2D array. Each row represents the marks of one student. Each column represents one assessment. For example, if we have two students and 3 assessment items with the marks for student1 being (67.6,88.5, 75.4} and student2 being (77.5, 76.2,78.3} our 2D array would look like: 67.6, 38.5,75.4 77.5, 76.2,78.3 You are to write a script/main function...
Matlab program in need of the solution is necessary within half an hour 8 marks 0-4 A- Printing numbers from 10 to 20 without number 15. B-Write in Matlab program to display all the prime numbers from 1 to 100. Q-5 8 marks A-Write Matlab program to read 5 numbers and determine if the numbers sorted ascending or not?
Logic Discrete Maths Question 3 & 4 3. [6 marks: 3 marks for steps, 3 marks for labels] Simplify the following statement using the laws and axioms of logic. Clearly state which law or axiom has been used at each step 4. [4 +4-8 marks] Given the following statements The student is in the esports club or in the aquatic club. If they are in the esports club then they do not get free access to the pool. The student...
JAVA PROGRAM: Guessing Game Objective The student will write an individualized program that utilizes conditional flow of control structures in Java. Specifications For this assignment, you will write a program that guesses a number chosen by your user. Your program will prompt the user to pick a number from 1 to 10. The program asks the user yes or no questions, and the guesses the user’s number. When the program starts up, it outputs a prompt asking the user to...
Problem Specification:Write a C++ program to calculate student’s GPA for the semester in your class. For each student,the program should accept a student’s name, ID number and the number of courses he/she istaking, then for each course the following data is needed the course number a string e.g. BU 101 course credits “an integer” grade received for the course “a character”.The program should display each student’s information and their courses information. It shouldalso display the GPA for the semester. The...
Question 3 Searching Algorithms [12 marks (4 marks) Define a method that when passed an array of integers arr and another integer target, returns the last index in arr where target exists and -1 if target isn't found in arr a. b. (4 marks) Provide a trace, in the form of a logic table, of running the following method for 1, 4, 4, 4, 5, 7, 8, 12, 12, 15, 16, 17, 35, 35, 35, 40 arr = target 14...
Question 7 10 points Save Write a Matlab or C program to store 12 temperature values in a day like per hour in°C in an array and display the temperature values and the average temperature value. example input: (22.4, 24, 28.2, 26.5, 23.7, 30, 31, 29.4. 28.4.27.3, 28, 29) TTT Art 3(12pt) T.E